This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "importing packages" Watch "importing packages" New topic

importing packages

asha rao

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 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: 1873
Hi asha 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,

-packageDir (its a directory same as package name 'packageDir' in classes)

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.

I agree. Here's the link:
subject: importing packages
It's not a secret anymore!