Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

package problem...

 
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
 
"The Hood"
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 :-)
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic