File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Importing own Packages" Watch "Importing own Packages" New topic

Importing own Packages

Jack Mullaly

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\;C:\JavaPrograms\Thinking\src

Please advise.

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.

Consultant, Sima Solutions
Jack Mullaly

Joined: Jun 07, 2006
Posts: 14
Thanks a Million Merrill.
I agree. Here's the link:
subject: Importing own Packages
jQuery in Action, 3rd edition