综述
详细内容
javac --help
Usage: javac <options> <source files>
where possible options include:
@<filename> Read options and filenames from file
-Akey[=value] Options to pass to annotation processors
--add-modules <module>(,<module>)*
Root modules to resolve in addition to the initial modules, or all modules
on the module path if <module> is ALL-MODULE-PATH.
--boot-class-path <path>, -bootclasspath <path>
Override location of bootstrap class files
--class-path <path>, -classpath <path>, -cp <path>
Specify where to find user class files and annotation processors
-d <directory> Specify where to place generated class files
-deprecation
Output source locations where deprecated APIs are used
--enable-preview
Enable preview language features. To be used in conjunction with either -source or --release.
-encoding <encoding> Specify character encoding used by source files
-endorseddirs <dirs> Override location of endorsed standards path
-extdirs <dirs> Override location of installed extensions
-g Generate all debugging info
-g:{lines,vars,source} Generate only some debugging info
-g:none Generate no debugging info
-h <directory>
Specify where to place generated native header files
--help, -help, -? Print this help message
--help-extra, -X Print help on extra options
-implicit:{none,class}
Specify whether or not to generate class files for implicitly referenced files
-J<flag> Pass <flag> directly to the runtime system
--limit-modules <module>(,<module>)*
Limit the universe of observable modules
--module <module>(,<module>)*, -m <module>(,<module>)*
Compile only the specified module(s), check timestamps
--module-path <path>, -p <path>
Specify where to find application modules
--module-source-path <module-source-path>
Specify where to find input source files for multiple modules
--module-version <version>
Specify version of modules that are being compiled
-nowarn Generate no warnings
-parameters
Generate metadata for reflection on method parameters
-proc:{none,only}
Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]
Names of the annotation processors to run; bypasses default discovery process
--processor-module-path <path>
Specify a module path where to find annotation processors
--processor-path <path>, -processorpath <path>
Specify where to find annotation processors
-profile <profile>
Check that API used is available in the specified profile
--release <release>
Compile for a specific release. Supported releases: 7, 8, 9, 10, 11, 12
-s <directory> Specify where to place generated source files
--source <release>, -source <release>
Provide source compatibility with specified release. Supported releases: 7, 8, 9, 10, 11, 12
--source-path <path>, -sourcepath <path>
Specify where to find input source files
--system <jdk>|none Override location of system modules
--target <release>, -target <release>
Generate class files for specific VM version. Supported versions: 7, 8, 9, 10, 11, 12
--upgrade-module-path <path>
Override location of upgradeable modules
-verbose Output messages about what the compiler is doing
--version, -version Version information
-Werror Terminate compilation if warnings occur
jar --help
Usage: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...
jar creates an archive for classes and resources, and can manipulate or
restore individual classes or resources from an archive.
Examples:
# Create an archive called classes.jar with two class files:
jar --create --file classes.jar Foo.class Bar.class
# Create an archive using an existing manifest, with all the files in foo/:
jar --create --file classes.jar --manifest mymanifest -C foo/ .
# Create a modular jar archive, where the module descriptor is located in
# classes/module-info.class:
jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0
-C foo/ classes resources
# Update an existing non-modular jar to a modular jar:
jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0
-C foo/ module-info.class
# Create a multi-release jar, placing some files in the META-INF/versions/9 directory:
jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
To shorten or simplify the jar command, you can specify arguments in a separate
text file and pass it to the jar command with the at sign (@) as a prefix.
Examples:
# Read additional options and list of class files from the file classes.list
jar --create --file my.jar @classes.list
Main operation mode:
-c, --create Create the archive
-i, --generate-index=FILE Generate index information for the specified jar
archives
-t, --list List the table of contents for the archive
-u, --update Update an existing jar archive
-x, --extract Extract named (or all) files from the archive
-d, --describe-module Print the module descriptor, or automatic module name
Operation modifiers valid in any mode:
-C DIR Change to the specified directory and include the
following file
-f, --file=FILE The archive file name. When omitted, either stdin or
stdout is used based on the operation
--release VERSION Places all following files in a versioned directory
of the jar (i.e. META-INF/versions/VERSION/)
-v, --verbose Generate verbose output on standard output
Operation modifiers valid only in create and update mode:
-e, --main-class=CLASSNAME The application entry point for stand-alone
applications bundled into a modular, or executable,
jar archive
-m, --manifest=FILE Include the manifest information from the given
manifest file
-M, --no-manifest Do not create a manifest file for the entries
--module-version=VERSION The module version, when creating a modular
jar, or updating a non-modular jar
--hash-modules=PATTERN Compute and record the hashes of modules
matched by the given pattern and that depend upon
directly or indirectly on a modular jar being
created or a non-modular jar being updated
-p, --module-path Location of module dependence for generating
the hash
Operation modifiers valid only in create, update, and generate-index mode:
-0, --no-compress Store only; use no ZIP compression
Other options:
-?, -h, --help[:compat] Give this, or optionally the compatibility, help
--help-extra Give help on extra options
--version Print program version
An archive is a modular jar if a module descriptor, 'module-info.class', is
located in the root of the given directories, or the root of the jar archive
itself. The following operations are only valid when creating a modular jar,
or updating an existing non-modular jar: '--module-version',
'--hash-modules', and '--module-path'.
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Comments | NOTHING