Issue
A have folders test/labs/tryouts in E:....\exps and two .java files inside tryouts. The location is added into CLASSPATH: E:....\exps.
import test.labs.tryouts.*;
Doesn't work (it's hihlighted with red) and the use of described in .java files classes also fails:
Uncompilable source code - cannot find symbol
symbol: class Bullet
location: class javaapplication1.Test1
at javaapplication1.Test1.main
What is wrong?
Solution
Quotes source: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html
Most IDEs are using -cp
or -classpath
option to set classpath for each project which is
preferred over setting the CLASSPATH environment variable because you can set it individually for each application without affecting other applications and without other applications modifying its value
Problem with it is that
-classpath
replaces the path or paths specified by the CLASSPATH environment variable while the tool runs:java
,jdb
,javac
,javah
andjdeps
.
So try to add that path to your project rather than CLASSPATH
. More info: How to setup classpath in Netbeans?
Answered By - Pshemo
Answer Checked By - Senaida (JavaFixing Volunteer)