I was compiling an JAVA ( 1.4 varsion )file and was getting the following error (about 100 times all are same).
Appli.java:721: cannot resolve symbol symbol : class License location: class test.App.Appli License sellLicense = sell.getLicense();
run/cmd/cd D:...../javac Appli.java
I had set the CLASSPATH variable, to the Classes folder of the java files I am presently running.
Control panel/Settings/System/System Properties /Advanced/Environmental Variables/System Variables/ Add/CLASSPATH
Should I use
How to solve the issue?
You need to set the CLASSPATH and make sure that you are in the correct directory.
test.App.Appl is trying to reference
test.App.License, the directory structure should be:
/somedir/test /somedir/test/App /somedir/test/App/Appl.java /somedir/test/App/License.java
You should set
"/somedir", then change your current directory to
/somedir and run the compiler as
javac test/App/*.java; e.g.
$ export CLASSPATH="/somedir" $ cd /somedir $ javac test/App/*.java
You can also use the
-cp command line option with the
javac (and later the
java) command, and you run the
javac compiler from a different directory by using the
The other possibility is that the package for
License is not
test.App. If that is the case, you need to adjust the directory structure to match the package naming, and add an
import statement to the
EDIT: If you notice a
pom.xml (or possibly even a
Makefile) in the source tree, you probably should not be using
javac directly. A
build.xml is for building using
Ant, a 'pom.xml
is for Maven (or Ivy) and aMakefile
You are probably missing an
It looks to me like you need to compile the class License with the class Appli. Take a look at the Javac Documentation for more details, but you can do something like the following:
javac Appli.java License.java
If License is in a library, you will need to add the library to your compilation classpath. This is done with the -classpath flag:
javac -classpath "classpath" Appli.java