6. javac commands and javac commands
Javac [options] [sourcefiles] [@ files] parameters can be arranged in any order. Options command line options. Sourcefiles one or more source files to be compiled (for example, MyClass. java ). @ Files one or more files listing source files. 1. View commands
-G |
Generate all debugging information |
-G: none |
No debugging information is generated |
-G: {lines, vars, source} |
Only some debugging information is generated. |
-Nowarn |
No warning is generated |
-Verbose |
Output the message about the operation being executed by the compiler. |
-Deprecation |
Output the source location of the obsolete 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> |
Overwrite the location of the bootstrap File |
-Extdirs <directory> |
Overwrite the location of the installed extension directory |
-Endorseddirs <directory> |
Location that overwrites 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 specified versions |
-Target <version> |
Generate class files for specific VM versions |
-Version |
Version Information |
-Help |
Output overview of standard options |
-X |
Output A summary of non-standard options |
J <flag> |
Directly pass the <flag> to the runtime system |
-D is used to specify the output directory.For example: javac-d. /classes HelloWorld. java means to put HelloWorld. place the compiled java bytecode file in the classes subdirectory of the current directory [note]: ①: if the specified directory does not exist, it will not be created successfully. ②: If HelloWorld. java has a package name named myJava. study. day01, then HelloWorld. the class file will be placed in the current directory/classes/myJava/study. in the day01/folder, if the path is not changed, it is automatically created.