Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange Compiler behavior. HELP!!

 
Scott Farran
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This may be an easy problem so any help will be appreciated, and thanks in advance.
I created a base class and then extended it in a child class. Everything was great (compiled and worked fine) until I created a package and put both classes in the package. Now the Base class still compiles but the child will not. It is throwing a compiler error on the class declareation.

public class nbn_GCOrderObject extends nbn_OrderObject {

the compiler error is as follows.....

---------javac--------
nbn_GCOrderObject.java:7: Cannot resolve symbol
symbol class nbn_OrderObject
location class nbn.nbn_GCOrderObject
class nbn_GCOrderObject extends nbn_OrderObject {
^
Why will it compile outside of the package but not inside it?? I have package statements at the top of both classes.
thanks,
Scott
SCJD
 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It probably has to do with the CLASSPATH. The classes must now be in a directory which is the name of the package, and the CLASSPATH must include that directory. As is, when compiling the child class, the compiler can no longer find the compiled parent. This is not an issue when you have no explicit package.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic