Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import statement

 
Mubeen Shaik
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic