Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Strange Compiler behavior.  HELP!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Strange Compiler behavior.  HELP!!" Watch "Strange Compiler behavior.  HELP!!" New topic
Author

Strange Compiler behavior. HELP!!

Scott Farran
Greenhorn

Joined: Mar 10, 2002
Posts: 9
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

Joined: May 08, 2002
Posts: 61
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange Compiler behavior. HELP!!