java
提供环境的一套配置
-Dprogram.name=run.sh
-Djboss.server.home.dir=/home/admin/deploy/jboss_server/default
-Djboss.server.home.url=file:/home/admin/deploy/jboss_server/default
-Djboss.server.log.dir=/home/admin/output/logs/jboss
-Djboss.server.temp.dir=/home/admin/output/run/jboss/tmp
-Djboss.server.data.dir=/home/admin/output/run/jboss/data
-Djava.library.path=/usr/app/tomcat-native/lib/
-Xms2g -Xmx2g -Xmn512m -XX:PermSize=256m -Xss256k
-XX:+DisableExplicitGC -XX:+UseParNewGC
-XX:+CMSParallelRemarkEnabled
-XX:+UseConcMarkSweepGC
-XX:+UseCMSCompactAtFullCollection
-XX:-ReduceInitialCardMarks
-XX:+UseFastAccessorMethods
-Djavax.net.ssl.trustStore=/home/admin/deploy/conf/ssl/keystore
-Dcrm.key.dir=/home/admin/deploy/conf/keystore
-Dcrm.key.id=yongyou
-Djava.net.preferIPv4Stack=true
-Djava.endorsed.dirs=/usr/app/jboss/lib/endorsed
具体内容可以查下表
javac
javac [ options ] [ sourcefiles ] [ classes ] [ @argfiles ]Arguments may be in any order.
options
- Command-line options.
sourcefiles
- One or more source files to be compiled (such as MyClass.java).
classes
- One or more classes to be processed for annotations (such as MyPackage.MyClass).
@argfiles
- One or more files that lists options and source files. The
-J
options are not allowed in these files.
DESCRIPTION
The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. It can also process annotations in Java source files and classes.
There are two ways to pass source code file names to javac:
- For a small number of source files, simply list the file names on the command line.
- For a large number of source files, list the file names in a file, separated by blanks or line breaks. Then use the list file name on thejavac command line, preceded by an@ character.
Source code file names must have
.java
suffixes, class file names must have.class
suffixes, and both source and class files must have root names that identify the class. For example, a class calledMyClass
would be written in a source file calledMyClass.java
and compiled into a bytecode class file calledMyClass.class
.Inner class definitions produce additional class files. These class files have names combining the inner and outer class names, such as
MyClass$MyInnerClass.class
.You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files inC:\workspace, the source code for
com.mysoft.mypack.MyClass
should be inC:\workspace\com\mysoft\mypack\MyClass.java.By default, the compiler puts each class file in the same directory as its source file. You can specify a separate destination directory with-d (seeOptions, below).
OPTIONS
The compiler has a set of standard options that are supported on the current development environment and will be supported in future releases. An additional set of non-standard options are specific to the current virtual machine and compiler implementations and are subject to change in the future. Non-standard options begin with -X.
Standard Options
- -A key[=value]
- Options to pass to annotation processors. These are not interpreted by javac directly, but are made available for use by individual processors. key should be one or more identifiers separated by ".".
- -cp path or -classpath path
- Specify where to find user class files, and (optionally) annotation processors and source files. This classpath overrides the user class path in the CLASSPATH environment variable. If neither CLASSPATH, -cp nor -classpath is specified, the user class path consists of the current directory. See Setting the Class Path for more details.
If the -sourcepath option is not specified, the user class path is also searched for source files.
If the -processorpath option is not specified, the classpath is also searched for annotation processors.
As a special convenience, a class path element containing a basename of
is considered equivalent to specifying a list of all the files in the directory with the extension
*.jar
or.JAR
.
For example, if directoryfoo
containsa.jar
andb.JAR
, then the class path elementfoo/*
is expanded toA.jar;b.JAR
, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of*
expands to a list of all the jar files in the current directory. TheCLASSPATH
environment variable, where defined, will be similarly expanded.Note: Depending of the configuration of your command line environment, you may have to quote the wild card character, for example,javac -cp "*.jar" MyClass.java
.- -Djava.ext.dirs= directories
- Override the location of installed extensions.
- -Djava.endorsed.dirs= directories
- Override the location of endorsed standards path.
- -d directory
- Set the destination directory for class files. The directory must already exist; javac will not create it. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -d C:\myclasses and the class is called
com.mypackage.MyClass
, then the class file is calledC:\myclasses\com\mypackage\MyClass.class
.If -d is not specified, javac puts each class files in the same directory as the source file from which it was generated.
Note: The directory specified by -d is not automatically added to your user class path.
- -deprecation
- Show a description of each use or override of a deprecated member or class. Without -deprecation, javac shows a summary of the source files that use or override deprecated members or classes. -deprecation is shorthand for -Xlint:deprecation.
- -encoding encoding
- Set the source file encoding name, such as
EUC-JP and UTF-8
. If -encoding is not specified, the platform default converter is used.- -g
- Generate all debugging information, including local variables. By default, only line number and source file information is generated.
- -g:none
- Do not generate any debugging information.
- -g: {keyword list}
- Generate only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are:
- source
- Source file debugging information
- lines
- Line number debugging information
- vars
- Local variable debugging information
-help Print a synopsis of standard options. -implicit: {class,none} Controls the generation of class files for implicitly loaded source files. To automatically generate class files, use -implicit:class. To suppress class file generation, use -implicit:none. If this option is not specified, the default is to automatically generate class files. In this case, the compiler will issue a warning if any such class files are generated when also doing annotation processing. The warning will not be issued if this option is set explicitly. See Searching For Types. -nowarn Disable warning messages. This has the same meaning as -Xlint:none. -proc: {none,only} Controls whether annotation processing and/or compilation is done. -proc:none means that compilation takes place without annotation processing. -proc:only means that only annotation processing is done, without any subsequent compilation. -processor class1[,class2,class3...] Names of the annotation processors to run. This bypasses the default discovery process. -processorpath path Specify where to find annotation processors; if this option is not used, the classpath will be searched for processors. -s dir Specify the directory where to place generated source files. The directory must already exist; javac will not create it. If a class is part of a package, the compiler puts the source file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -s C:\mysrc and the class is called com.mypackage.MyClass
, then the source file will be placed inC:\mysrc\com\mypackage\MyClass.java
.-source release Specifies the version of source code accepted. The following values for release are allowed:
- 1.3
- The compiler does not support assertions, generics, or other language features introduced after JDK 1.3.
- 1.4
- The compiler accepts code containing assertions, which were introduced in JDK 1.4.
- 1.5
- The compiler accepts code containing generics and other language features introduced in JDK 5.
- 5
- Synonym for 1.5.
- 1.6
- This is the default value. No language changes were introduced in Java SE 6. However, encoding errors in source files are now reported as errors, instead of warnings, as previously.
- 6
- Synonym for 1.6.
-sourcepath sourcepath Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by semicolons ( ;) and can be directories, JAR archives, or ZIP archives. If packages are used, the local path name within the directory or archive must reflect the package name. Note: Classes found through the classpath may be subject to automatic recompilation if their sources are also found. SeeSearching For Types.
-verbose Verbose output. This includes information about each class loaded and each source file compiled. -version Print version information. -X Display information about non-standard options and exit.
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform thatjavac shipped with. Butjavac also supportscross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use-bootclasspath and-extdirs when cross-compiling; seeCross-Compilation Example below.
- -target version
- Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1 1.2 1.3 1.4 1.5 (also 5) and 1.6 (also 6).
The default for -target depends on the value of -source:
- If -source is not specified, the value of -target is 1.6
- If -source is 1.2, the value of -target is 1.4
- If -source is 1.3, the value of -target is 1.4
- For all other values of -source, the value of -target is the value of-source.
- -bootclasspath bootclasspath
- Cross-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by semicolons ( ;) and can be directories, JAR archives, or ZIP archives.
- -extdirs directories
- Cross-compile against the specified extension directories. Directories is a semicolon-separated list of directories. Each JAR archive in the specified directories is searched for class files.
Non-Standard Options
- -Xbootclasspath/p: path
- Prepend to the bootstrap class path.
- -Xbootclasspath/a: path
- Append to the bootstrap class path.
- -Xbootclasspath/: path
- Override location of bootstrap class files.
- -Xlint
- Enable all recommended warnings. In this release, all available warnings are recommended.
- -Xlint:none
- Disable all warnings not mandated by the Java Language Specification.
- -Xlint:-name
- Disable warning name, where name is one of the warning names supported for -Xlint: name, below.
- -Xlint:unchecked
- Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification.
- -Xlint:path
- Warn about nonexistent path (classpath, sourcepath, etc) directories.
- -Xlint:serial
- Warn about missing
serialVersionUID
definitions on serializable classes.- -Xlint:finally
- Warn about
finally
clauses that cannot complete normally.- -Xlint:fallthrough
- Check switch blocks for fall-through cases and provide a warning message for any that are found. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to "fall through" from that case to the next case. For example, the code following the case 1 label in this switch block does not end with a break statement:
If the -Xlint:fallthrough flag were used when compiling this code, the compiler would emit a warning about "possible fall-through into case," along with the line number of the case in question.switch (x) {
case 1:
System.out.println("1");
// No break; statement here.
case 2:
System.out.println("2");
}- -Xmaxerrs number
- Set the maximum number of errors to print.
- -Xmaxwarns number
- Set the maximum number of warnings to print.
- -Xstdout filename
- Send compiler messages to the named file. By default, compiler messages go to
System.err
.- -Xprefer: {newer,source}
- Specify which file to read when both a source file and class file are found for a type. (See Searching For Types). If -Xprefer:newer is used, it reads the newer of the source or class file for a type (default). If the -Xprefer:source option is used, it reads source file. Use -Xprefer:source when you want to be sure that any annotation processors can access annotations declared with a retention policy of
SOURCE
.- -Xprint
- Print out textual representation of specified types for debugging purposes; perform neither annotation processing nor compilation. The format of the output may change.
- -XprintProcessorInfo
- Print information about which annotations a processor is asked to process.
- -XprintRounds
- Print information about initial and subsequent annotation processing rounds.
The -J Option
- -Joption
- Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes. Although it does not begin with -X, it is not a `standard option' of javac. It is a common convention for -J to pass options to the underlying VM executing applications written in Java.
Note: CLASSPATH, -classpath, -bootclasspath, and-extdirs donot specify the classes used to runjavac. Fiddling with the implementation of the compiler in this way is usually pointless and always risky. If you do need to do this, use the-J option to pass through options to the underlyingjava launcher.
COMMAND LINE ARGUMENT FILES
To shorten or simplify the javac command line, you can specify one or more files that themselves contain arguments to the
javac
command (except-J
options). This enables you to create javac commands of any length on any operating system.An argument file can include javac options and source filenames in any combination. The arguments within a file can be space-separated or newline-separated. If a filename contains embedded spaces, put the whole filename in double quotes, and double each backslash (
"My Files\\Stuff.java"
).Filenames within an argument file are relative to the current directory, not the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying
*.java
). Use of the '@' character to recursively interpret files is not supported. The-J
options are not supported because they are passed to the launcher, which does not support argument files.When executing javac, pass in the path and name of each argument file with the '@' leading character. When javac encounters an argument beginning with the character `@', it expands the contents of that file into the argument list.
Example - Single Arg File
You could use a single argument file named "
argfile
" to hold all javac arguments:C:> javac @argfileThis argument file could contain the contents of both files shown in the next example.
Example - Two Arg Files
You can create two argument files -- one for the javac options and the other for the source filenames: (Notice the following lists have no line-continuation characters.)
Create a file named "
options
" containing:-d classes
-g
-sourcepath C:\java\pubs\ws\1.3\src\share\classesCreate a file named "
classes
" containing:MyClass1.java
MyClass2.java
MyClass3.java
java
提供环境的一套配置
-Dprogram.name=run.sh
-Djboss.server.home.dir=/home/admin/deploy/jboss_server/default
-Djboss.server.home.url=file:/home/admin/deploy/jboss_server/default
-Djboss.server.log.dir=/home/admin/output/logs/jboss
-Djboss.server.temp.dir=/home/admin/output/run/jboss/tmp
-Djboss.server.data.dir=/home/admin/output/run/jboss/data
-Djava.library.path=/usr/app/tomcat-native/lib/
-Xms2g -Xmx2g -Xmn512m -XX:PermSize=256m -Xss256k
-XX:+DisableExplicitGC -XX:+UseParNewGC
-XX:+CMSParallelRemarkEnabled
-XX:+UseConcMarkSweepGC
-XX:+UseCMSCompactAtFullCollection
-XX:-ReduceInitialCardMarks
-XX:+UseFastAccessorMethods
-Djavax.net.ssl.trustStore=/home/admin/deploy/conf/ssl/keystore
-Dcrm.key.dir=/home/admin/deploy/conf/keystore
-Dcrm.key.id=yongyou
-Djava.net.preferIPv4Stack=true
-Djava.endorsed.dirs=/usr/app/jboss/lib/endorsed
Categories of Java HotSpot VM Options
Standard options recognized by the Java HotSpot VM are described on the Java Application Launcher reference pages forWindows,Solaris and Linux. This document deals exclusively with non-standard options recognized by the Java HotSpot VM:
- Options that begin with
-X
are non-standard (not guaranteed to be supported on all VM implementations), and are subject to change without notice in subsequent releases of the JDK. - Options that are specified with
-XX
are not stable and are subject to change without notice.
Some Useful -XX Options
Default values are listed for Java SE 6 for Solaris Sparc with -server. Some options may vary per architecture/OS/JVM version. Platforms with a differing default value are listed in the description.
- Boolean options are turned on with
-XX:+<option>
and turned off with-XX:-<option>
. - Numeric options are set with
-XX:<option>=<number>
. Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or 'G' for gigabytes (for example, 32k is the same as 32768). - String options are set with
-XX:<option>=<string>
, are usually used to specify a file, a path, or a list of commands
Flags marked as manageable are dynamically writeable through the JDK management interface (com.sun.management.HotSpotDiagnosticMXBean API) and also through JConsole. InMonitoring and Managing Java SE 6 Platform Applications, Figure 3 shows an example. The manageable flags can also be set throughjinfo -flag.
The options below are loosely grouped into categories.
- Behavioral options change the basic behavior of the VM.
- Garbage First (G1) Garbage Collection Options
- Performance tuning options are knobs which can be used to tune VM performance.
- Debugging options generally enable tracing, printing, or output of VM information.
Behavioral Options
Option and Default Value | Description |
---|---|
-XX:-AllowUserSignalHandlers | Do not complain if the application installs signal handlers. (Relevant to Solaris and Linux only.) |
-XX:AltStackSize=16384 | Alternate signal stack size (in Kbytes). (Relevant to Solaris only, removed from 5.0.) |
-XX:-DisableExplicitGC | Disable calls to System.gc(), JVM still performs garbage collection when necessary. |
-XX:+FailOverToOldVerifier | Fail over to old verifier when the new type checker fails. (Introduced in 6.) |
-XX:+HandlePromotionFailure | The youngest generation collection does not require a guarantee of full promotion of all live objects. (Introduced in 1.4.2 update 11) [5.0 and earlier: false.] |
-XX:+MaxFDLimit | Bump the number of file descriptors to max. (Relevant to Solaris only.) |
-XX:PreBlockSpin=10 | Spin count variable for use with -XX:+UseSpinning. Controls the maximum spin iterations allowed before entering operating system thread synchronization code. (Introduced in 1.4.2.) |
-XX:-RelaxAccessControlCheck | Relax the access control checks in the verifier. (Introduced in 6.) |
-XX:+ScavengeBeforeFullGC | Do young generation GC prior to a full GC. (Introduced in 1.4.1.) |
-XX:+UseAltSigs | Use alternate signals instead of SIGUSR1 and SIGUSR2 for VM internal signals. (Introduced in 1.3.1 update 9, 1.4.1. Relevant to Solaris only.) |
-XX:+UseBoundThreads | Bind user level threads to kernel threads. (Relevant to Solaris only.) |
-XX:-UseConcMarkSweepGC | Use concurrent mark-sweep collection for the old generation. (Introduced in 1.4.1) |
-XX:+UseGCOverheadLimit | Use a policy that limits the proportion of the VM's time that is spent in GC before an OutOfMemory error is thrown. (Introduced in 6.) |
-XX:+UseLWPSynchronization | Use LWP-based instead of thread based synchronization. (Introduced in 1.4.0. Relevant to Solaris only.) |
-XX:-UseParallelGC | Use parallel garbage collection for scavenges. (Introduced in 1.4.1) |
-XX:-UseParallelOldGC | Use parallel garbage collection for the full collections. Enabling this option automatically sets -XX:+UseParallelGC. (Introduced in 5.0 update 6.) |
-XX:-UseSerialGC | Use serial garbage collection. (Introduced in 5.0.) |
-XX:-UseSpinning | Enable naive spinning on Java monitor before entering operating system thread synchronizaton code. (Relevant to 1.4.2 and 5.0 only.) [1.4.2, multi-processor Windows platforms: true] |
-XX:+UseTLAB | Use thread-local object allocation (Introduced in 1.4.0, known as UseTLE prior to that.) [1.4.2 and earlier, x86 or with -client: false] |
-XX:+UseSplitVerifier | Use the new type checker with StackMapTable attributes. (Introduced in 5.0.)[5.0: false] |
-XX:+UseThreadPriorities | Use native thread priorities. |
-XX:+UseVMInterruptibleIO | Thread interrupt before or with EINTR for I/O operations results in OS_INTRPT. (Introduced in 6. Relevant to Solaris only.) |
Back to Options
Garbage First (G1)Garbage Collection Options
Option and Default Value | Description |
---|---|
-XX:+UseG1GC | Use the Garbage First (G1) Collector |
-XX:MaxGCPauseMillis=n | Sets a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it. |
-XX:InitiatingHeapOccupancyPercent=n | Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by GCs that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (e.g., G1). A value of 0 denotes 'do constant GC cycles'. The default value is 45. |
-XX:NewRatio=n | Ratio of new/old generation sizes. The default value is 2. |
-XX:SurvivorRatio=n | Ratio of eden/survivor space size. The default value is 8. |
-XX:MaxTenuringThreshold=n | Maximum value for tenuring threshold. The default value is 15. |
-XX:ParallelGCThreads=n | Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running. |
-XX:ConcGCThreads=n | Number of threads concurrent garbage collectors will use. The default value varies with the platform on which the JVM is running. |
-XX:G1ReservePercent=n | Sets the amount of heap that is reserved as a false ceiling to reduce the possibility of promotion failure. The default value is 10. |
-XX:G1HeapRegionSize=n | With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions. The default value of this parameter is determined ergonomically based upon heap size. The minimum value is 1Mb and the maximum value is 32Mb. |
Back to Options
PerformanceOptions
Option and Default Value | Description |
---|---|
-XX:+AggressiveOpts | Turn on point performance compiler optimizations that are expected to be default in upcoming releases. (Introduced in 5.0 update 6.) |
-XX:CompileThreshold=10000 | Number of method invocations/branches before compiling [-client: 1,500] |
-XX:LargePageSizeInBytes=4m | Sets the large page size used for the Java heap. (Introduced in 1.4.0 update 1.) [amd64: 2m.] |
-XX:MaxHeapFreeRatio=70 | Maximum percentage of heap free after GC to avoid shrinking. |
-XX:MaxNewSize=size | Maximum size of new generation (in bytes). Since 1.4, MaxNewSize is computed as a function of NewRatio. [1.3.1 Sparc: 32m; 1.3.1 x86: 2.5m.] |
-XX:MaxPermSize=64m | Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.] |
-XX:MinHeapFreeRatio=40 | Minimum percentage of heap free after GC to avoid expansion. |
-XX:NewRatio=2 | Ratio of new/old generation sizes. [Sparc -client: 8; x86 -server: 8; x86 -client: 12.]-client: 4 (1.3) 8 (1.3.1+), x86: 12] |
-XX:NewSize=2.125m | Default size of new generation (in bytes) [5.0 and newer: 64 bit VMs are scaled 30% larger; x86: 1m; x86, 5.0 and older: 640k] |
-XX:ReservedCodeCacheSize=32m | Reserved code cache size (in bytes) - maximum code cache size. [Solaris 64-bit, amd64, and -server x86: 48m; in 1.5.0_06 and earlier, Solaris 64-bit and and64: 1024m.] |
-XX:SurvivorRatio=8 | Ratio of eden/survivor space size [Solaris amd64: 6; Sparc in 1.3.1: 25; other Solaris platforms in 5.0 and earlier: 32] |
-XX:TargetSurvivorRatio=50 | Desired percentage of survivor space used after scavenge. |
-XX:ThreadStackSize=512 | Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] |
-XX:+UseBiasedLocking | Enable biased locking. For more details, see this tuning example. (Introduced in 5.0 update 6.) [5.0: false] |
-XX:+UseFastAccessorMethods | Use optimized versions of Get<Primitive>Field. |
-XX:-UseISM | Use Intimate Shared Memory. [Not accepted for non-Solaris platforms.] For details, seeIntimate Shared Memory. |
-XX:+UseLargePages | Use large page memory. (Introduced in 5.0 update 5.) For details, see Java Support for Large Memory Pages. |
-XX:+UseMPSS | Use Multiple Page Size Support w/4mb pages for the heap. Do not use with ISM as this replaces the need for ISM. (Introduced in 1.4.0 update 1, Relevant to Solaris 9 and newer.) [1.4.1 and earlier: false] |
-XX:+UseStringCache | Enables caching of commonly allocated strings. |
-XX:AllocatePrefetchLines=1 | Number of cache lines to load after the last object allocation using prefetch instructions generated in JIT compiled code. Default values are 1 if the last allocated object was an instance and 3 if it was an array. |
-XX:AllocatePrefetchStyle=1 | Generated code style for prefetch instructions. 0 - no prefetch instructions are generate*d*, 1 - execute prefetch instructions after each allocation, 2 - use TLAB allocation watermark pointer to gate when prefetch instructions are executed. |
-XX:+UseCompressedStrings | Use a byte[] for Strings which can be represented as pure ASCII. (Introduced in Java 6 Update 21 Performance Release) |
-XX:+OptimizeStringConcat | Optimize String concatenation operations where possible. (Introduced in Java 6 Update 20) |
Back to Options
DebuggingOptions
Option and Default Value | Description |
---|---|
-XX:-CITime | Prints time spent in JIT Compiler. (Introduced in 1.4.0.) |
-XX:ErrorFile=./hs_err_pid<pid>.log | If an error occurs, save the error data to this file. (Introduced in 6.) |
-XX:-ExtendedDTraceProbes | Enable performance-impacting dtrace probes. (Introduced in 6. Relevant to Solaris only.) |
-XX:HeapDumpPath=./java_pid<pid>.hprof | Path to directory or filename for heap dump. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.) |
-XX:-HeapDumpOnOutOfMemoryError | Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.) |
-XX:OnError="<cmd args>;<cmd args>" | Run user-defined commands on fatal error. (Introduced in 1.4.2 update 9.) |
-XX:OnOutOfMemoryError="<cmd args>; <cmd args>" |
Run user-defined commands when an OutOfMemoryError is first thrown. (Introduced in 1.4.2 update 12, 6) |
-XX:-PrintClassHistogram | Print a histogram of class instances on Ctrl-Break. Manageable. (Introduced in 1.4.2.) Thejmap -histo command provides equivalent functionality. |
-XX:-PrintConcurrentLocks | Print java.util.concurrent locks in Ctrl-Break thread dump. Manageable. (Introduced in 6.) Thejstack -l command provides equivalent functionality. |
-XX:-PrintCommandLineFlags | Print flags that appeared on the command line. (Introduced in 5.0.) |
-XX:-PrintCompilation | Print message when a method is compiled. |
-XX:-PrintGC | Print messages at garbage collection. Manageable. |
-XX:-PrintGCDetails | Print more details at garbage collection. Manageable. (Introduced in 1.4.0.) |
-XX:-PrintGCTimeStamps | Print timestamps at garbage collection. Manageable (Introduced in 1.4.0.) |
-XX:-PrintTenuringDistribution | Print tenuring age information. |
-XX:-TraceClassLoading | Trace loading of classes. |
-XX:-TraceClassLoadingPreorder | Trace all classes loaded in order referenced (not loaded). (Introduced in 1.4.2.) |
-XX:-TraceClassResolution | Trace constant pool resolutions. (Introduced in 1.4.2.) |
-XX:-TraceClassUnloading | Trace unloading of classes. |
-XX:-TraceLoaderConstraints | Trace recording of loader constraints. (Introduced in 6.) |
-XX:+PerfSaveDataToFile | Saves jvmstat binary data on exit. |
-XX:ParallelGCThreads= | Sets the number of garbage collection threads in the young and old parallel garbage collectors. The default value varies with the platform on which the JVM is running. |
-XX:+UseCompressedOops | Enables the use of compressed pointers (object references represented as 32 bit offsets instead of 64-bit pointers) for optimized 64-bit performance with Java heap sizes less than 32gb. |
-XX:+AlwaysPreTouch | Pre-touch the Java heap during JVM initialization. Every page of the heap is thus demand-zeroed during initialization rather than incrementally during application execution. |
-XX:AllocatePrefetchDistance= | Sets the prefetch distance for object allocation. Memory about to be written with the value of new objects is prefetched into cache at this distance (in bytes) beyond the address of the last allocated object. Each Java thread has its own allocation point. The default value varies with the platform on which the JVM is running. |
-XX:InlineSmallCode= | Inline a previously compiled method only if its generated native code size is less than this. The default value varies with the platform on which the JVM is running. |
-XX:MaxInlineSize=35 | Maximum bytecode size of a method to be inlined. |
-XX:FreqInlineSize= | Maximum bytecode size of a frequently executed method to be inlined. The default value varies with the platform on which the JVM is running. |
-XX:LoopUnrollLimit= | Unroll loop bodies with server compiler intermediate representation node count less than this value. The limit used by the server compiler is a function of this value, not the actual value. The default value varies with the platform on which the JVM is running. |
-XX:InitialTenuringThreshold=7 | Sets the initial tenuring threshold for use in adaptive GC sizing in the parallel young collector. The tenuring threshold is the number of times an object survives a young collection before being promoted to the old, or tenured, generation. |
-XX:MaxTenuringThreshold= | Sets the maximum tenuring threshold for use in adaptive GC sizing. The current largest value is 15. The default value is 15 for the parallel collector and is 4 for CMS. |