Symbols not found in Java Compilation

Source: Internet
Author: User

 

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.