Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package problem...

 
raja srinivas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am writing an application that has to reference another package,
my directory structure is
Directory1----->Subdirectory1------>SubsubDirectory1
----->SubDirectory2
Now i have the Directory1 in my Classpath, and my Foo.java 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 Boo.java file which i reference in Foo.java. The Boo.java 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 Foo.java i get a compiler error saying
"package Directory1.Subdirectory2 does not exist"
can anyone solve this problem of mine ? How do i reference Boo.java in my Foo.java
Thanks
Raj
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if Directory1 is in your classpath, then your package name should be
Subdirectory1.SubsubDirectory
The way it is the system is looking for the Directory1 directory under the classpath directory named Directory1.
 
raja srinivas
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup it works....
thanks Cindy :-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic