Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing classes from a package

 
aleks nikolic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's going on when you get error like :
cannot access Line
bad class file : .\Line.class
class file contains wrong class : home.geometry.Line
Please remove or make sure it appears in the correct subdirectory of the
classpath
I have the subdirectory of \home\geometry in my CLASSPATH . Line is part
of package home.geometry and is in \home\geometry . So I don't get it .
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
\home\geomerty should not be in your classpath, instead the root of the class tree should be.
For example, if I have a class home.geometry.Ugh located in c:\java\stuff\home\geometry\Ugh.class then my classpath should contain c:\java\stuff
The Java classloader will automatically add the "\home\geometry" for you because the class is in the package home.geometry.
 
aleks nikolic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah , sorry I stated it wrong . home\geometry is not in my class path , the root is .
I find if I set classpath at the command line it works though . So it appears it was checking the current directory first and that was screwing it up . If I set at command line , then it doesn't check current directory .
Probably if I set my environment CLASSPATH with current directory coming after package root , it would be OK also.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic