My coding experience has only gone back a few years, so this question should be easy enough to answer.
I have written two interfaces: Class and Game. Interface CLASS is supposed to extend interface GAME.
Here are the two interface sources:
package Impl;
public interface Game
{
//METHODS AND VARS
}
package Impl;
public interface Class extends Game
{
//METHODS AND VARS
}
Now, when I try to compile the second interface, I get the following error
class.java:4: cannot find symbol
symbol: class Game
public interface Class extends Game
^
My Game class is compiled and the class file is in the same directory as both java files. I have not been able to find a solution. Does anyone have any ideas?
Class names are case sensitive. It is possible that you have created an interface called game
, but you refer to it in your Class
interface declaration as Game
, which the compiler cannot find.
However, there is another chance that you are compiling from within your Impl
package. To do this, you will need to reference your classpath such that the compiler can find classes from the base of the package structure. You can add a -classpath ..
arg to your javac
before the class name:
javac -classpath .. Class.java
Alternatively, you can do what is more common, compiling from the root of your package structure. To do so, you will need to specify the path to your Class
file:
javac Impl\Class.java
you can always add a -classpath .
to be clear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With