wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes importing packages 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 "importing packages" Watch "importing packages" New topic
Author

importing packages

asha rao
Greenhorn

Joined: Apr 27, 2004
Posts: 4
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

Joined: Nov 04, 2001
Posts: 1871
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing packages
 
Similar Threads
java.awt.*; and java.awt.event.*
Packages are not detecting
Is import java.util.List faster than java.util.*
Object "Savvy"
Packages