It's not a secret anymore!
The moose likes Beginning Java and the fly likes package problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package problem..." Watch "package problem..." New topic

package problem...

raja srinivas

Joined: Jun 22, 2001
Posts: 20
I am writing an application that has to reference another package,
my directory structure is
Now i have the Directory1 in my Classpath, and my file is in SubsubDirectory1 in which i declare its package as
package Directory1.Subdirectory1.SubsubDirectory ;
in this same file i have an import statement
import Directory1.Subdirectory2.*;
now this subdirectory contains a file which i reference in The file is also not compiled yet and it has the package statement as follows
package Directory1.Subdirectory2;
now my first question is
when i compile the i get a compiler error saying
"package Directory1.Subdirectory2 does not exist"
can anyone solve this problem of mine ? How do i reference in my
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
if Directory1 is in your classpath, then your package name should be
The way it is the system is looking for the Directory1 directory under the classpath directory named Directory1.

"JavaRanch, where the deer and the Certified play" - David O'Meara
raja srinivas

Joined: Jun 22, 2001
Posts: 20
yup it works....
thanks Cindy :-)
I agree. Here's the link:
subject: package problem...
It's not a secret anymore!