Skip to content
Advertisement

Cannot find symbol in same package and directory

I have two classes, Offering and Course. They are both in the same package and the same directory.

Offering.java:

JavaScript

Course.java:

JavaScript

When I try to compile Offering, I get the errors:

JavaScript

and

JavaScript

I know that the error means the compiler is unable to do anything with ‘Course,’ but I don’t really know why. I also know that it will end up being something incredibly obvious, but I just can’t seem to figure it out. Any help would be really appreciated.

Advertisement

Answer

Change directories to the parent directory of assignment02. You should then be able to use

JavaScript

or

JavaScript

or even

JavaScript

The compiler is is looking for the Course class in the assignment02 package FROM your current directory (so when you’re in the assignment02 directory, it’s effectively trying to look in assignment02/assignment02, which obviously isn’t right).

While this will correct your current problem you will then get the following error:

JavaScript

Which will need to corrected.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement