File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Strange Compiler behavior. HELP!!

Scott Farran

Joined: Mar 10, 2002
Posts: 9
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-------- 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.
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:
subject: Strange Compiler behavior. HELP!!
It's not a secret anymore!