Accessing User Packages

Posted on 2005-04-27
Last Modified: 2010-03-31
Hi Experts,

I thought this would be a straight forward question but looking @ PAQ it is not :-s. I have created a suite a of classes that form a Package SConnnect. I need various other apps/pjojects/clasess out side the Sconnect to see/use these classes. How do I import them in to a diffrent app.

I using Jbuilder if that makes any diffrence.

Question by:GTwoD
    LVL 86

    Expert Comment

    Surely just add the jar to the project ..?
    LVL 86

    Expert Comment

    (and import them with import statements of course)
    LVL 2

    Accepted Solution

    In project properties, go to "Required Libs"
    Click Add, then New
    Enter a name for your lib, add all jars/classes required
    Hit OK to close.

    Hit OK to select the newly created lib
    Ok again to close project properties.

    In your code, need to import your package and compile again. It should work
    LVL 15

    Expert Comment

    >> Package SConnnect
    It is conventional to name packages using only lowercase characters (e.g. sconnect)

    >>  need various other apps/pjojects/clasess out side the Sconnect to see/use these classes
    As long as your classes inside SConnect are defined as public other classes which are not inside that package should be able to use them.
    If you have a class which is not "public" it will not be accessible outside its package.
    You do need to import those classes (or do import SConnnect.*) as CEHJ suggested.
    LVL 1

    Author Comment

    Sorry for the long delay, it is a lot simpler than I thought I was getting confused with having to put classes in the lib directory to import them.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now