"javac -X" - Specifying Non-Standard Options

This section describes the Java compiler non-standard options, '-X...'.

Java compiler "javac" can also take non-standard options by using the "-X..." format. Here is a list of "javac" non-standard options:

herong> javac -X

--add-exports <module>/<package>=<other-module>(,<other-module>)*
   Specify a package to be considered as exported from its defining
   module to additional modules, or to all unnamed modules if
   <other-module> is ALL-UNNAMED.
--add-reads <module>=<other-module>(,<other-module>)*
   Specify additional modules to be considered as required by a
   given module. <other-module> may be ALL-UNNAMED to require the
   unnamed module.
--default-module-for-created-files <module-name>
   Fallback target module for files created by annotation
   processors, if none specified or inferred.
   Override location of endorsed standards path
-Djava.ext.dirs=<dirs>       Override location of installed extensions
--doclint-format {html4,html5}
   Specify the format for documentation comments
--patch-module <module>=<file>(:<file>)*
   Override or augment a module with classes and resources
   in JAR files or directories
-Xbootclasspath:<path>       Override location of bootstrap class files
-Xbootclasspath/a:<path>     Append to the bootstrap class path
-Xbootclasspath/p:<path>     Prepend to the bootstrap class path
-Xdiags:{compact,verbose}    Select a diagnostic mode
   Enable recommended checks for problems in javadoc comments
   Enable or disable specific checks for problems in javadoc comments,
   where <group> is one of accessibility, html, missing, reference, or
   syntax, and <access> is one of public, protected, package, or private.
   Enable or disable checks in specific packages. Each <package> is
   either the qualified name of a package or a package name prefix
   followed by .*, which expands to all sub-packages of the given
   package. Each <package> can be prefixed with - to disable checks
   for the specified package or packages.
-Xlint                       Enable recommended warnings
   Warnings to enable or disable, separated by comma.
   Precede a key by - to disable the specified warning.
   Supported keys are:
      all              Enable all warnings
      auxiliaryclass   Warn about an auxiliary class that is
         hidden in a source file, and is used from other files.
      cast             Warn about use of unnecessary casts.
         Warn about issues related to classfile contents.
      deprecation      Warn about use of deprecated items.
      dep-ann          Warn about items marked as deprecated in
         JavaDoc but not using the @Deprecated annotation.
      divzero          Warn about division by constant integer 0.
      empty            Warn about empty statement after if.
      exports          Warn about issues regarding module exports.
      fallthrough      Warn about falling through from one case
         of a switch statement to the next.
         Warn about finally clauses that do not terminate normally.
      module           Warn about module system related issues.
      opens            Warn about issues regarding module opens.
         Warn about issues relating to use of command line options.
      overloads        Warn about issues regarding method overloads.
      overrides        Warn about issues regarding method overrides.
         Warn about invalid path elements on the command line.
      processing       Warn about issues regarding annotation processing.
      rawtypes         Warn about use of raw types.
         Warn about use of API that has been marked for removal.
         Warn about use of automatic modules in the requires clauses.
         Warn about automatic modules in requires transitive.
      serial           Warn about Serializable classes that do not provide
         a serial version ID. Also warn about access to non-public members
         from a serializable element.
         Warn about accessing a static member using an instance.
      try              Warn about issues relating to use of try blocks
         (i.e. try-with-resources).
      unchecked        Warn about unchecked operations.
      varargs          Warn about potentially unsafe vararg methods
      none             Disable all warnings
-Xmaxerrs <number>           Set the maximum number of errors to print
-Xmaxwarns <number>          Set the maximum number of warnings to print
      Specify handling of package-info files
-Xplugin:"name args"
      Name and optional arguments for a plug-in to be run
      Specify which file to read when both a source file and class file
      are found for an implicitly compiled class
      Print out a textual representation of specified types
      Print information about which annotations a processor is asked
      to process
      Print information about rounds of annotation processing
-Xstdout <filename>          Redirect standard output

These extra options are subject to change without notice.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

javac - The Java Program Compiler

 javac - Java Compilation Command and Options

 Compiling Hello.java - My First Java Program

 "javac -classpath" - Specifying Class Path

 "javac -verbose" - Printing Compilation Details

 "javac -sourcepath" - Specifying Source Path

 "javac -d" - Specifying Output Directory

 Two Types of "import" Statements

 "import" Statements Processed by "javac"

 "javac -g" - Controlling Debugging Information

 "javac --module" - Compiling Entire Module

"javac -X" - Specifying Non-Standard Options

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials


 Full Version in PDF/EPUB