Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Importing own Packages

 
Jack Mullaly
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jack Mullaly
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Million Merrill.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic