my dog learned polymorphism*
The moose likes Beginning Java and the fly likes import statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import statement" Watch "import statement" New topic
Author

import statement

Mubeen Shaik
Ranch Hand

Joined: Jan 26, 2004
Posts: 67
Hi All,
I have some classes in this directory C:\Java\Package\Test. I want to import these.
I am working on C:\Java\Project. I am developing the new code in this directory.
I am getting compilation error on import statement. Any help on this ?
Thanks in advance,
Mubeen


Sun Certified Java Programmer
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
Hi Mubeen,
to be able to import your classes you first have to put them into
a package, following some strict
rules.
After that you should build a jar file and include it in your classpath.
(At least this is how I succeded with my package).
After this, your import statement should work from any other
directory.
Mubeen Shaik
Ranch Hand

Joined: Jan 26, 2004
Posts: 67
Hi All,
I have created the jar file and added that in Classpath. Now i tried compile the program and it is giving me the following error.
"package not found".
I am reading "Thinking in Java" 3rd edition. It is using one class and in that class there is "package" statement.
Any help on this ?.
Thanks in advance,
Mubeen.
 
Consider Paul's rocket mass heater.
 
subject: import statement
 
Similar Threads
Reading a file using Scanner
Importing classes
Package
Marcus Green "package question"
Classpath issue?