Normally, when we write java files, we will reference some self-defined classes. If we compile according to the usual javac *.java format, it will not be found. Symbol error. (Recommended: java video tutorial)
The following two methods are provided for reference
If there are a.java and b under d:/web/wsh .java two files, a.java is referenced in the b.java file. The following is the compilation method
Method 1:
Enter d:/web/wsh: javac a.java
Then exit the wsh directory and enter javac wsh/b.java under d:/wsh The compilation is successful!
Method 2: Enter d:/web/wsh by using javac -classpath(cp) parameter
: javac a.java
Still in d:/wsh/wsh Next: javac -classpath d:/web/wsh b.java
This can also compile successfully!
For more java knowledge, please pay attention to the java basic tutorial column.
The above is the detailed content of Java error not found symbol solution (referencing custom class). For more information, please follow other related articles on the PHP Chinese website!