Generally, when writing a Java file, some classes defined by the user will be referenced. If the compilation is in the form of javac *. Java, the symbol cannot be found.
The following two methods are provided for reference:
Assume that there are two files a. Java and B. Java under D:/web/wsh, and A. Java is referenced in the B. Java file. The following is the compilation method.
Method 1:
Enter javac A. Java under D:/web/wsh
Then exit the wsh directory and enter javac wsh/B. Java under D:/wsh to compile successfully!
Method 2: Use the javac-classpath (CP) parameter
Enter javac A. Java under D:/web/wsh
Still under D:/wsh: javac-classpath D:/web/wsh B. Java
This can also be compiled successfully!
The following methods have passed the test!
The following are javac compilation parameters:
Usage: javac <option> <Source File>
Option:
-G: None does not generate any debugging information
-G: {lines, vars, source} only generates some debugging information
-Nowarn does not generate any warning
-Verbose outputs messages about the operations being performed by the compiler.
-Deprecation: output the source location of an outdated API
-Classpath <path> specifies the location for searching user class files.
-CP <path> specifies the location for searching user-class files
-Sourcepath <path> specifies the location of the Input Source file to be searched.
-Bootclasspath <path> overwrites the position of the boot class file
-Extdirs <directory> overwrites the location of the installed extension directory.
-Endorseddirs <directory> overwrites the location of the standard path of the signature.
-D <directory> specifies the location where the generated class files are stored.
-Encoding <encoding> specifies the character encoding used by the source file.
-Source <version> provides source compatibility with the specified version.
-Target <version> generates class files of a specific VM version.
-Version Version Information
-Help: output the summary of standard options.
-X outputs a feed of non-standard options
-J <flag> directly transmits the <flag> to the runtime system
...............
Unfortunately, none of the above methods solved my problem. I only need to find another solution.
References:
Http://hnwsha.blog.sohu.com/139863651.html