Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

importing packages  RSS feed

 
asha rao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

i have some problem importing packages ......please help me

i have crearted 3 class -class one ,class two and class three(has main method and have created objects for class one and two),now to excute my program i created a package for both class one and class three (in same source file)and try to import that in class three.......but it gives a error messg -package not present in import......

how should i excute my program.......is it got to do with my path variable which i have set to bin of my jdk
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi asha

Okay...to make things clear, let me write what I would do if I were you,

- If we are on windows platform having following file/dir structure,

c:\java\programs>
-packageDir (its a directory same as package name 'packageDir' in classes)
|__one.java
|__two.java
|__three.java

c:\java\programs>javac -classpath %CLASSPATH%;. packageDir\*.java

Here, I have three source files, each having package declaration as,
pacakge pacakgeDir;

This should work.

Also, in your description I didn't see that you have mentioned package name in class two, is it so?

Let us know if the approach I mention works for you.

Thanks
Maulin
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!