This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Importing own Packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Importing own Packages" Watch "Importing own Packages" New topic
Author

Importing own Packages

Jack Mullaly
Greenhorn

Joined: Jun 07, 2006
Posts: 14
I am using NetBeans IDE. I can import all Java API packages by using the command import java.util.*;, etc.
But if I create a Project which has a package called "thinking", and try to import "thinking" from another Project. Compiler gives a message saying "thinking" does not exist.

The directory path for "thinking" is C:\JavaPrograms\Thinking\src\thinking.
And I have added it to the Classpath Variable which now looks like:
.;C:\Program Files\Java\jre1.5.0_07\lib\ext\QTJava.zip;C:\JavaPrograms\Thinking\src

Please advise.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You have to tell NetBeans where to look for classes in a specific project. To do this:

1-in the Projects panel, find the project and right-click it.

2-Select properties from the context menu.

3-Select Libraries in the categories panel

4-Click the Add Project button

5-Select the project that contains your "thinking" package, and press the Add Project button.


Merrill
Consultant, Sima Solutions
Jack Mullaly
Greenhorn

Joined: Jun 07, 2006
Posts: 14
Thanks a Million Merrill.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Importing own Packages
 
Similar Threads
Commonly used term?
About Blutooth in J2me
Accessing files in NetBeans
Problems using GDate and JDate