blob: bc8f1f105b795e024575ed422a746d1b783ff676 [file] [log] [blame]
rgallardb6435452013-11-25 20:19:02 -08001'\" t
rgallard36ba8532014-06-06 15:45:48 -07002.\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
3.\"
4.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5.\"
6.\" This code is free software; you can redistribute it and/or modify it
7.\" under the terms of the GNU General Public License version 2 only, as
8.\" published by the Free Software Foundation.
9.\"
10.\" This code is distributed in the hope that it will be useful, but WITHOUT
11.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13.\" version 2 for more details (a copy is included in the LICENSE file that
14.\" accompanied this code).
15.\"
16.\" You should have received a copy of the GNU General Public License version
17.\" 2 along with this work; if not, write to the Free Software Foundation,
18.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19.\"
20.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21.\" or visit www.oracle.com if you need additional information or have any
22.\" questions.
23.\"
24.\" Title: java
25.\" Language: English
26.\" Date: 08 August 2014
27.\" SectDesc: Basic Tools
28.\" Software: JDK 8
29.\" Arch: generic
30.\" Part Number: E38207-03
rgallardb6435452013-11-25 20:19:02 -080031.\"
32.if n .pl 99999
rgallard36ba8532014-06-06 15:45:48 -070033.TH "java" "1" "08 August 2014" "JDK 8" "Basic Tools"
34.\" -----------------------------------------------------------------
35.\" * Define some portability stuff
36.\" -----------------------------------------------------------------
37.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38.\" http://bugs.debian.org/507673
39.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
40.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41.ie \n(.g .ds Aq \(aq
42.el .ds Aq '
43.\" -----------------------------------------------------------------
44.\" * set default formatting
45.\" -----------------------------------------------------------------
46.\" disable hyphenation
47.nh
48.\" disable justification (adjust text to left margin only)
49.ad l
50.\" -----------------------------------------------------------------
51.\" * MAIN CONTENT STARTS HERE *
52.\" -----------------------------------------------------------------
53.SH "NAME"
rgallardb6435452013-11-25 20:19:02 -080054java \- Launches a Java application\&.
rgallard36ba8532014-06-06 15:45:48 -070055.SH "SYNOPSIS"
56.sp
57.if n \{\
58.RS 4
59.\}
60.nf
rgallardb6435452013-11-25 20:19:02 -080061\fBjava\fR [\fIoptions\fR] \fIclassname\fR [\fIargs\fR]
rgallard36ba8532014-06-06 15:45:48 -070062.fi
63.if n \{\
64.RE
65.\}
66.sp
67.if n \{\
68.RS 4
69.\}
70.nf
rgallardb6435452013-11-25 20:19:02 -080071\fBjava\fR [\fIoptions\fR] \fB\-jar\fR \fIfilename\fR [\fIargs\fR]
rgallard36ba8532014-06-06 15:45:48 -070072.fi
73.if n \{\
74.RE
75.\}
rgallardb6435452013-11-25 20:19:02 -080076.PP
rgallard36ba8532014-06-06 15:45:48 -070077\fIoptions\fR
78.RS 4
79Command\-line options separated by spaces\&. See Options\&.
80.RE
81.PP
82\fIclassname\fR
83.RS 4
84The name of the class to be launched\&.
85.RE
86.PP
87\fIfilename\fR
88.RS 4
89The name of the Java Archive (JAR) file to be called\&. Used only with the
90\fB\-jar\fR
91option\&.
92.RE
93.PP
94\fIargs\fR
95.RS 4
96The arguments passed to the
97\fBmain()\fR
98method separated by spaces\&.
99.RE
100.SH "DESCRIPTION"
101.PP
102The
103\fBjava\fR
104command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\*(Aqs
105\fBmain()\fR
106method\&. The method must be declared
107\fIpublic\fR
108and
109\fIstatic\fR, it must not return any value, and it must accept a
110\fBString\fR
111array as a parameter\&. The method declaration has the following form:
112.sp
113.if n \{\
114.RS 4
115.\}
116.nf
117\fBpublic static void main(String[] args)\fR
118
119.fi
120.if n \{\
121.RE
122.\}
123.PP
124The
125\fBjava\fR
126command can be used to launch a JavaFX application by loading a class that either has a
127\fBmain()\fR
128method or that extends
129\fBjavafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the
130\fBApplication\fR
131class, calls its
132\fBinit()\fR
133method, and then calls the
134\fBstart(javafx\&.stage\&.Stage)\fR
135method\&.
136.PP
137By default, the first argument that is not an option of the
138\fBjava\fR
139command is the fully qualified name of the class to be called\&. If the
140\fB\-jar\fR
141option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the
142\fBMain\-Class\fR
143manifest header in its source code\&.
rgallardb6435452013-11-25 20:19:02 -0800144.PP
145The JRE searches for the startup class (and other classes used by the application) in three sets of locations: the bootstrap class path, the installed extensions, and the user\(cqs class path\&.
146.PP
rgallard36ba8532014-06-06 15:45:48 -0700147Arguments after the class file name or the JAR file name are passed to the
148\fBmain()\fR
149method\&.
150.SH "OPTIONS"
151.PP
152The
153\fBjava\fR
154command supports a wide range of options that can be divided into the following categories:
155.sp
156.RS 4
157.ie n \{\
158\h'-04'\(bu\h'+03'\c
159.\}
160.el \{\
161.sp -1
162.IP \(bu 2.3
163.\}
rgallardb6435452013-11-25 20:19:02 -0800164Standard Options
rgallard36ba8532014-06-06 15:45:48 -0700165.RE
166.sp
167.RS 4
168.ie n \{\
169\h'-04'\(bu\h'+03'\c
170.\}
171.el \{\
172.sp -1
173.IP \(bu 2.3
174.\}
175Non\-Standard Options
176.RE
177.sp
178.RS 4
179.ie n \{\
180\h'-04'\(bu\h'+03'\c
181.\}
182.el \{\
183.sp -1
184.IP \(bu 2.3
185.\}
rgallardb6435452013-11-25 20:19:02 -0800186Advanced Runtime Options
rgallard36ba8532014-06-06 15:45:48 -0700187.RE
188.sp
189.RS 4
190.ie n \{\
191\h'-04'\(bu\h'+03'\c
192.\}
193.el \{\
194.sp -1
195.IP \(bu 2.3
196.\}
rgallardb6435452013-11-25 20:19:02 -0800197Advanced JIT Compiler Options
rgallard36ba8532014-06-06 15:45:48 -0700198.RE
199.sp
200.RS 4
201.ie n \{\
202\h'-04'\(bu\h'+03'\c
203.\}
204.el \{\
205.sp -1
206.IP \(bu 2.3
207.\}
rgallardb6435452013-11-25 20:19:02 -0800208Advanced Serviceability Options
rgallard36ba8532014-06-06 15:45:48 -0700209.RE
210.sp
211.RS 4
212.ie n \{\
213\h'-04'\(bu\h'+03'\c
214.\}
215.el \{\
216.sp -1
217.IP \(bu 2.3
218.\}
rgallardb6435452013-11-25 20:19:02 -0800219Advanced Garbage Collection Options
rgallard36ba8532014-06-06 15:45:48 -0700220.RE
rgallardb6435452013-11-25 20:19:02 -0800221.PP
222Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM)\&. They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on\&.
223.PP
rgallard36ba8532014-06-06 15:45:48 -0700224Non\-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with
225\fB\-X\fR\&.
rgallardb6435452013-11-25 20:19:02 -0800226.PP
rgallard36ba8532014-06-06 15:45:48 -0700227Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with
228\fB\-XX\fR\&.
rgallardb6435452013-11-25 20:19:02 -0800229.PP
230To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document\&.
231.PP
rgallard36ba8532014-06-06 15:45:48 -0700232Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean
233\fB\-XX\fR
234options are enabled using the plus sign (\fB\-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\fB\-XX:\-\fR\fIOptionName\fR)\&.
rgallardb6435452013-11-25 20:19:02 -0800235.PP
rgallard36ba8532014-06-06 15:45:48 -0700236For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix
237\fBk\fR
238or
239\fBK\fR
240for kilobytes (KB),
241\fBm\fR
242or
243\fBM\fR
244for megabytes (MB),
245\fBg\fR
246or
247\fBG\fR
248for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either
249\fB8g\fR,
250\fB8192m\fR,
251\fB8388608k\fR, or
252\fB8589934592\fR
253as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify
254\fB0\&.25\fR
255for 25%)\&.
256.SS "Standard Options"
257.PP
rgallardb6435452013-11-25 20:19:02 -0800258These are the most commonly used options that are supported by all implementations of the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -0700259.PP
260\-agentlib:\fIlibname\fR[=\fIoptions\fR]
261.RS 4
262Loads the specified native agent library\&. After the library name, a comma\-separated list of options specific to the library can be used\&.
263.sp
264If the option
265\fB\-agentlib:foo\fR
266is specified, then the JVM attempts to load the library named
267\fBlibfoo\&.so\fR
268in the location specified by the
269\fBLD_LIBRARY_PATH\fR
270system variable (on OS X this variable is
271\fBDYLD_LIBRARY_PATH\fR)\&.
272.sp
rgallardb6435452013-11-25 20:19:02 -0800273The following example shows how to load the heap profiling tool (HPROF) library and get sample CPU information every 20 ms, with a stack depth of 3:
rgallard36ba8532014-06-06 15:45:48 -0700274.sp
275.if n \{\
276.RS 4
277.\}
278.nf
279\fB\-agentlib:hprof=cpu=samples,interval=20,depth=3\fR
280
281.fi
282.if n \{\
283.RE
284.\}
rgallardb6435452013-11-25 20:19:02 -0800285The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads:
rgallard36ba8532014-06-06 15:45:48 -0700286.sp
287.if n \{\
288.RS 4
289.\}
290.nf
291\fB\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fR
292
293.fi
294.if n \{\
295.RE
296.\}
rgallardb6435452013-11-25 20:19:02 -0800297For more information about the native agent libraries, refer to the following:
rgallard36ba8532014-06-06 15:45:48 -0700298.sp
299.RS 4
300.ie n \{\
301\h'-04'\(bu\h'+03'\c
302.\}
303.el \{\
304.sp -1
305.IP \(bu 2.3
306.\}
307The
308\fBjava\&.lang\&.instrument\fR
309package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
310.RE
311.sp
312.RS 4
313.ie n \{\
314\h'-04'\(bu\h'+03'\c
315.\}
316.el \{\
317.sp -1
318.IP \(bu 2.3
319.\}
rgallardb6435452013-11-25 20:19:02 -0800320Agent Command Line Options in the JVM Tools Interface guide at http://docs\&.oracle\&.com/javase/8/docs/platform/jvmti/jvmti\&.html#starting
rgallard36ba8532014-06-06 15:45:48 -0700321.RE
322.RE
323.PP
324\-agentpath:\fIpathname\fR[=\fIoptions\fR]
325.RS 4
326Loads the native agent library specified by the absolute path name\&. This option is equivalent to
327\fB\-agentlib\fR
328but uses the full path and file name of the library\&.
329.RE
330.PP
331\-client
332.RS 4
333Selects the Java HotSpot Client VM\&. The 64\-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
334.sp
335For default JVM selection, see Server\-Class Machine Detection at
rgallardb6435452013-11-25 20:19:02 -0800336
rgallard36ba8532014-06-06 15:45:48 -0700337http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
338.RE
339.PP
340\-D\fIproperty\fR=\fIvalue\fR
341.RS 4
342Sets a system property value\&. The
343\fIproperty\fR
344variable is a string with no spaces that represents the name of the property\&. The
345\fIvalue\fR
346variable is a string that represents the value of the property\&. If
347\fIvalue\fR
348is a string with spaces, then enclose it in quotation marks (for example
349\fB\-Dfoo="foo bar"\fR)\&.
350.RE
351.PP
352\-d32
353.RS 4
354Runs the application in a 32\-bit environment\&. If a 32\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
355.RE
356.PP
357\-d64
358.RS 4
359Runs the application in a 64\-bit environment\&. If a 64\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
360.sp
361Currently only the Java HotSpot Server VM supports 64\-bit operation, and the
362\fB\-server\fR
363option is implicit with the use of
364\fB\-d64\fR\&. The
365\fB\-client\fR
366option is ignored with the use of
367\fB\-d64\fR\&. This is subject to change in a future release\&.
368.RE
369.PP
370\-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
rgallardb6435452013-11-25 20:19:02 -0800371.br
rgallard36ba8532014-06-06 15:45:48 -0700372\-da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
373.RS 4
rgallardb6435452013-11-25 20:19:02 -0800374Disables assertions\&. By default, assertions are disabled in all packages and classes\&.
rgallard36ba8532014-06-06 15:45:48 -0700375.sp
376With no arguments,
377\fB\-disableassertions\fR
378(\fB\-da\fR) disables assertions in all packages and classes\&. With the
379\fIpackagename\fR
380argument ending in
381\fB\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply
382\fB\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the
383\fIclassname\fR
384argument, the switch disables assertions in the specified class\&.
385.sp
386The
387\fB\-disableassertions\fR
388(\fB\-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The
389\fB\-disablesystemassertions\fR
390option enables you to disable assertions in all system classes\&.
391.sp
392To explicitly enable assertions in specific packages or classes, use the
393\fB\-enableassertions\fR
394(\fB\-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the
395\fBMyClass\fR
396application with assertions enabled in package
397\fBcom\&.wombat\&.fruitbat\fR
398(and any subpackages) but disabled in class
399\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
400.sp
401.if n \{\
402.RS 4
403.\}
rgallardb6435452013-11-25 20:19:02 -0800404.nf
rgallard36ba8532014-06-06 15:45:48 -0700405\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
406
rgallardb6435452013-11-25 20:19:02 -0800407.fi
rgallard36ba8532014-06-06 15:45:48 -0700408.if n \{\
409.RE
410.\}
411.RE
412.PP
413\-disablesystemassertions
414.br
415\-dsa
416.RS 4
417Disables assertions in all system classes\&.
418.RE
419.PP
420\-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
421.br
422\-ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
423.RS 4
rgallardb6435452013-11-25 20:19:02 -0800424Enables assertions\&. By default, assertions are disabled in all packages and classes\&.
rgallard36ba8532014-06-06 15:45:48 -0700425.sp
426With no arguments,
427\fB\-enableassertions\fR
428(\fB\-ea\fR) enables assertions in all packages and classes\&. With the
429\fIpackagename\fR
430argument ending in
431\fB\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply
432\fB\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the
433\fIclassname\fR
434argument, the switch enables assertions in the specified class\&.
435.sp
436The
437\fB\-enableassertions\fR
438(\fB\-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The
439\fB\-enablesystemassertions\fR
440option provides a separate switch to enable assertions in all system classes\&.
441.sp
442To explicitly disable assertions in specific packages or classes, use the
443\fB\-disableassertions\fR
444(\fB\-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the
445\fBMyClass\fR
446application with assertions enabled only in package
447\fBcom\&.wombat\&.fruitbat\fR
448(and any subpackages) but disabled in class
449\fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
450.sp
451.if n \{\
452.RS 4
453.\}
454.nf
455\fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
456
457.fi
458.if n \{\
459.RE
460.\}
461.RE
462.PP
463\-enablesystemassertions
rgallardb6435452013-11-25 20:19:02 -0800464.br
rgallard36ba8532014-06-06 15:45:48 -0700465\-esa
466.RS 4
rgallardb6435452013-11-25 20:19:02 -0800467Enables assertions in all system classes\&.
rgallard36ba8532014-06-06 15:45:48 -0700468.RE
469.PP
470\-help
rgallardb6435452013-11-25 20:19:02 -0800471.br
rgallard36ba8532014-06-06 15:45:48 -0700472\-?
473.RS 4
474Displays usage information for the
475\fBjava\fR
476command without actually running the JVM\&.
477.RE
478.PP
479\-jar \fIfilename\fR
480.RS 4
481Executes a program encapsulated in a JAR file\&. The
482\fIfilename\fR
483argument is the name of a JAR file with a manifest that contains a line in the form
484\fBMain\-Class:\fR\fIclassname\fR
485that defines the class with the
486\fBpublic static void main(String[] args)\fR
487method that serves as your application\*(Aqs starting point\&.
488.sp
489When you use the
490\fB\-jar\fR
491option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
492.sp
rgallardb6435452013-11-25 20:19:02 -0800493For more information about JAR files, see the following resources:
rgallard36ba8532014-06-06 15:45:48 -0700494.sp
495.RS 4
496.ie n \{\
497\h'-04'\(bu\h'+03'\c
498.\}
499.el \{\
500.sp -1
501.IP \(bu 2.3
502.\}
rgallardb6435452013-11-25 20:19:02 -0800503jar(1)
rgallard36ba8532014-06-06 15:45:48 -0700504.RE
505.sp
506.RS 4
507.ie n \{\
508\h'-04'\(bu\h'+03'\c
509.\}
510.el \{\
511.sp -1
512.IP \(bu 2.3
513.\}
rgallardb6435452013-11-25 20:19:02 -0800514The Java Archive (JAR) Files guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/jar/index\&.html
rgallard36ba8532014-06-06 15:45:48 -0700515.RE
516.sp
517.RS 4
518.ie n \{\
519\h'-04'\(bu\h'+03'\c
520.\}
521.el \{\
522.sp -1
523.IP \(bu 2.3
524.\}
525Lesson: Packaging Programs in JAR Files at
rgallardb6435452013-11-25 20:19:02 -0800526
rgallard36ba8532014-06-06 15:45:48 -0700527http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
528.RE
529.RE
530.PP
531\-javaagent:\fIjarpath\fR[=\fIoptions\fR]
532.RS 4
533Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the
534\fBjava\&.lang\&.instrument\fR
535package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
536.RE
537.PP
538\-jre\-restrict\-search
539.RS 4
540Includes user\-private JREs in the version search\&.
541.RE
542.PP
543\-no\-jre\-restrict\-search
544.RS 4
545Excludes user\-private JREs from the version search\&.
546.RE
547.PP
548\-server
549.RS 4
550Selects the Java HotSpot Server VM\&. The 64\-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
551.sp
552For default JVM selection, see Server\-Class Machine Detection at
rgallardb6435452013-11-25 20:19:02 -0800553
rgallard36ba8532014-06-06 15:45:48 -0700554http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
555.RE
556.PP
557\-showversion
558.RS 4
559Displays version information and continues execution of the application\&. This option is equivalent to the
560\fB\-version\fR
561option except that the latter instructs the JVM to exit after displaying version information\&.
562.RE
563.PP
564\-splash:\fIimgname\fR
565.RS 4
566Shows the splash screen with the image specified by
567\fIimgname\fR\&. For example, to show the
568\fBsplash\&.gif\fR
569file from the
570\fBimages\fR
571directory when starting your application, use the following option:
572.sp
573.if n \{\
574.RS 4
575.\}
576.nf
577\fB\-splash:images/splash\&.gif\fR
578
579.fi
580.if n \{\
581.RE
582.\}
583.RE
584.PP
585\-verbose:class
586.RS 4
rgallardb6435452013-11-25 20:19:02 -0800587Displays information about each loaded class\&.
rgallard36ba8532014-06-06 15:45:48 -0700588.RE
589.PP
590\-verbose:gc
591.RS 4
rgallardb6435452013-11-25 20:19:02 -0800592Displays information about each garbage collection (GC) event\&.
rgallard36ba8532014-06-06 15:45:48 -0700593.RE
594.PP
595\-verbose:jni
596.RS 4
rgallardb6435452013-11-25 20:19:02 -0800597Displays information about the use of native methods and other Java Native Interface (JNI) activity\&.
rgallard36ba8532014-06-06 15:45:48 -0700598.RE
599.PP
600\-version
601.RS 4
602Displays version information and then exits\&. This option is equivalent to the
603\fB\-showversion\fR
604option except that the latter does not instruct the JVM to exit after displaying version information\&.
605.RE
606.PP
607\-version:\fIrelease\fR
608.RS 4
609Specifies the release version to be used for running the application\&. If the version of the
610\fBjava\fR
611command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
612.sp
613The
614\fIrelease\fR
615argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A
616\fIversion string\fR
617is the developer designation of the version number in the following form:
618\fB1\&.\fR\fIx\fR\fB\&.0_\fR\fIu\fR
619(where
620\fIx\fR
621is the major version number, and
622\fIu\fR
623is the update version number)\&. A
624\fIversion range\fR
625is made up of a version string followed by a plus sign (\fB+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\fB*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical
626\fIOR\fR
627combination, or an ampersand (\fB&\fR) for a logical
628\fIAND\fR
629combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
630.sp
631.if n \{\
632.RS 4
633.\}
634.nf
635\fB\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fR
636
637.fi
638.if n \{\
639.RE
640.\}
641Quotation marks are necessary only if there are spaces in the
642\fIrelease\fR
643parameter\&.
644.sp
rgallardb6435452013-11-25 20:19:02 -0800645For JAR files, the preference is to specify version requirements in the JAR file manifest rather than on the command line\&.
rgallard36ba8532014-06-06 15:45:48 -0700646.RE
647.SS "Non\-Standard Options"
648.PP
rgallardb6435452013-11-25 20:19:02 -0800649These options are general purpose options that are specific to the Java HotSpot Virtual Machine\&.
rgallard36ba8532014-06-06 15:45:48 -0700650.PP
651\-X
652.RS 4
653Displays help for all available
654\fB\-X\fR
655options\&.
656.RE
657.PP
658\-Xbatch
659.RS 4
660Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The
661\fB\-Xbatch\fR
662flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
663.sp
664This option is equivalent to
665\fB\-XX:\-BackgroundCompilation\fR\&.
666.RE
667.PP
668\-Xbootclasspath:\fIpath\fR
669.RS 4
rgallardb6435452013-11-25 20:19:02 -0800670Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to search for boot class files\&. These are used in place of the boot class files included in the JDK\&.
rgallard36ba8532014-06-06 15:45:48 -0700671.sp
672Do not deploy applications that use this option to override a class in
673\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
674.RE
675.PP
676\-Xbootclasspath/a:\fIpath\fR
677.RS 4
rgallardb6435452013-11-25 20:19:02 -0800678Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to append to the end of the default bootstrap class path\&.
rgallard36ba8532014-06-06 15:45:48 -0700679.sp
680Do not deploy applications that use this option to override a class in
681\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
682.RE
683.PP
684\-Xbootclasspath/p:\fIpath\fR
685.RS 4
rgallardb6435452013-11-25 20:19:02 -0800686Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to prepend to the front of the default bootstrap class path\&.
rgallard36ba8532014-06-06 15:45:48 -0700687.sp
688Do not deploy applications that use this option to override a class in
689\fBrt\&.jar\fR, because this violates the JRE binary code license\&.
690.RE
691.PP
692\-Xcheck:jni
693.RS 4
rgallardb6435452013-11-25 20:19:02 -0800694Performs additional checks for Java Native Interface (JNI) functions\&. Specifically, it validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request\&. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with an irrecoverable error in such cases\&. Expect a performance degradation when this option is used\&.
rgallard36ba8532014-06-06 15:45:48 -0700695.RE
696.PP
697\-Xcomp
698.RS 4
699Forces compilation of methods on first invocation\&. By default, the Client VM (\fB\-client\fR) performs 1,000 interpreted method invocations and the Server VM (\fB\-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the
700\fB\-Xcomp\fR
701option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
702.sp
703You can also change the number of interpreted method invocations before compilation using the
704\fB\-XX:CompileThreshold\fR
705option\&.
706.RE
707.PP
708\-Xdebug
709.RS 4
rgallardb6435452013-11-25 20:19:02 -0800710Does nothing\&. Provided for backward compatibility\&.
rgallard36ba8532014-06-06 15:45:48 -0700711.RE
712.PP
713\-Xdiag
714.RS 4
rgallardb6435452013-11-25 20:19:02 -0800715Shows additional diagnostic messages\&.
rgallard36ba8532014-06-06 15:45:48 -0700716.RE
717.PP
718\-Xfuture
719.RS 4
720Enables strict class\-file format checks that enforce close conformance to the class\-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
721.RE
722.PP
723\-Xint
724.RS 4
725Runs the application in interpreted\-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
726.RE
727.PP
728\-Xinternalversion
729.RS 4
730Displays more detailed JVM version information than the
731\fB\-version\fR
732option, and then exits\&.
733.RE
734.PP
735\-Xloggc:\fIfilename\fR
736.RS 4
737Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of
738\fB\-verbose:gc\fR
739with the time elapsed since the first GC event preceding each logged event\&. The
740\fB\-Xloggc\fR
741option overrides
742\fB\-verbose:gc\fR
743if both are given with the same
744\fBjava\fR
745command\&.
746.sp
rgallardb6435452013-11-25 20:19:02 -0800747Example:
rgallard36ba8532014-06-06 15:45:48 -0700748.sp
749.if n \{\
750.RS 4
751.\}
752.nf
753\fB\-Xloggc:garbage\-collection\&.log\fR
754
755.fi
756.if n \{\
757.RE
758.\}
759.RE
760.PP
761\-Xmaxjitcodesize=\fIsize\fR
762.RS 4
763Specifies the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
764\fBk\fR
765or
766\fBK\fR
767to indicate kilobytes,
768\fBm\fR
769or
770\fBM\fR
771to indicate megabytes,
772\fBg\fR
773or
774\fBG\fR
775to indicate gigabytes\&. By default, the value is set to 48 MB:
776.sp
777.if n \{\
778.RS 4
779.\}
780.nf
781\fB\-Xmaxjitcodesize=48m\fR
782
783.fi
784.if n \{\
785.RE
786.\}
787This option is equivalent to
788\fB\-XX:ReservedCodeCacheSize\fR\&.
789.RE
790.PP
791\-Xmixed
792.RS 4
rgallardb6435452013-11-25 20:19:02 -0800793Executes all bytecode by the interpreter except for hot methods, which are compiled to native code\&.
rgallard36ba8532014-06-06 15:45:48 -0700794.RE
795.PP
796\-Xmn\fIsize\fR
797.RS 4
798Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
799\fBk\fR
800or
801\fBK\fR
802to indicate kilobytes,
803\fBm\fR
804or
805\fBM\fR
806to indicate megabytes,
807\fBg\fR
808or
809\fBG\fR
810to indicate gigabytes\&.
811.sp
rgallardb6435452013-11-25 20:19:02 -0800812The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too small, then a lot of minor garbage collections will be performed\&. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
rgallard36ba8532014-06-06 15:45:48 -0700813.sp
rgallardb6435452013-11-25 20:19:02 -0800814The following examples show how to set the initial and maximum size of young generation to 256 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -0700815.sp
816.if n \{\
817.RS 4
818.\}
819.nf
820\fB\-Xmn256m\fR
821\fB\-Xmn262144k\fR
822\fB\-Xmn268435456\fR
823
824.fi
825.if n \{\
826.RE
827.\}
828Instead of the
829\fB\-Xmn\fR
830option to set both the initial and maximum size of the heap for the young generation, you can use
831\fB\-XX:NewSize\fR
832to set the initial size and
833\fB\-XX:MaxNewSize\fR
834to set the maximum size\&.
835.RE
836.PP
837\-Xms\fIsize\fR
838.RS 4
839Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter
840\fBk\fR
841or
842\fBK\fR
843to indicate kilobytes,
844\fBm\fR
845or
846\fBM\fR
847to indicate megabytes,
848\fBg\fR
849or
850\fBG\fR
851to indicate gigabytes\&.
852.sp
rgallardb6435452013-11-25 20:19:02 -0800853The following examples show how to set the size of allocated memory to 6 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -0700854.sp
855.if n \{\
856.RS 4
857.\}
858.nf
859\fB\-Xms6291456\fR
860\fB\-Xms6144k\fR
861\fB\-Xms6m\fR
862
863.fi
864.if n \{\
865.RE
866.\}
867If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the
868\fB\-Xmn\fR
869option or the
870\fB\-XX:NewSize\fR
871option\&.
872.RE
873.PP
874\-Xmx\fIsize\fR
875.RS 4
876Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
877\fBk\fR
878or
879\fBK\fR
880to indicate kilobytes,
881\fBm\fR
882or
883\fBM\fR
884to indicate megabytes,
885\fBg\fR
886or
887\fBG\fR
888to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
889\fB\-Xms\fR
890and
891\fB\-Xmx\fR
892are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
893.sp
rgallardb6435452013-11-25 20:19:02 -0800894The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -0700895.sp
896.if n \{\
897.RS 4
898.\}
899.nf
900\fB\-Xmx83886080\fR
901\fB\-Xmx81920k\fR
902\fB\-Xmx80m\fR
903
904.fi
905.if n \{\
906.RE
907.\}
908The
909\fB\-Xmx\fR
910option is equivalent to
911\fB\-XX:MaxHeapSize\fR\&.
912.RE
913.PP
914\-Xnoclassgc
915.RS 4
rgallardb6435452013-11-25 20:19:02 -0800916Disables garbage collection (GC) of classes\&. This can save some GC time, which shortens interruptions during the application run\&.
rgallard36ba8532014-06-06 15:45:48 -0700917.sp
918When you specify
919\fB\-Xnoclassgc\fR
920at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
921.RE
922.PP
923\-Xprof
924.RS 4
rgallardb6435452013-11-25 20:19:02 -0800925Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
rgallard36ba8532014-06-06 15:45:48 -0700926.RE
927.PP
928\-Xrs
929.RS 4
rgallardb6435452013-11-25 20:19:02 -0800930Reduces the use of operating system signals by the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -0700931.sp
rgallardb6435452013-11-25 20:19:02 -0800932Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly\&.
rgallard36ba8532014-06-06 15:45:48 -0700933.sp
934The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses
935\fBSIGHUP\fR,
936\fBSIGINT\fR, and
937\fBSIGTERM\fR
938to initiate the running of shutdown hooks\&.
939.sp
940The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses
941\fBSIGQUIT\fR
942to perform thread dumps\&.
943.sp
944Applications embedding the JVM frequently need to trap signals such as
945\fBSIGINT\fR
946or
947\fBSIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The
948\fB\-Xrs\fR
949option is available to address this issue\&. When
950\fB\-Xrs\fR
951is used, the signal masks for
952\fBSIGINT\fR,
953\fBSIGTERM\fR,
954\fBSIGHUP\fR, and
955\fBSIGQUIT\fR
956are not changed by the JVM, and signal handlers for these signals are not installed\&.
957.sp
958There are two consequences of specifying
959\fB\-Xrs\fR:
960.sp
961.RS 4
962.ie n \{\
963\h'-04'\(bu\h'+03'\c
964.\}
965.el \{\
966.sp -1
967.IP \(bu 2.3
968.\}
969\fBSIGQUIT\fR
970thread dumps are not available\&.
971.RE
972.sp
973.RS 4
974.ie n \{\
975\h'-04'\(bu\h'+03'\c
976.\}
977.el \{\
978.sp -1
979.IP \(bu 2.3
980.\}
981User code is responsible for causing shutdown hooks to run, for example, by calling
982\fBSystem\&.exit()\fR
983when the JVM is to be terminated\&.
984.RE
985.RE
986.PP
987\-Xshare:\fImode\fR
988.RS 4
989Sets the class data sharing mode\&. Possible
990\fImode\fR
991arguments for this option include the following:
992.PP
rgallardb6435452013-11-25 20:19:02 -0800993auto
rgallard36ba8532014-06-06 15:45:48 -0700994.RS 4
995Use shared class data if possible\&. This is the default value for Java HotSpot 32\-Bit Client VM\&.
996.RE
997.PP
rgallardb6435452013-11-25 20:19:02 -0800998on
rgallard36ba8532014-06-06 15:45:48 -0700999.RS 4
rgallardb6435452013-11-25 20:19:02 -08001000Require the use of class data sharing\&. Print an error message and exit if class data sharing cannot be used\&.
rgallard36ba8532014-06-06 15:45:48 -07001001.RE
1002.PP
rgallardb6435452013-11-25 20:19:02 -08001003off
rgallard36ba8532014-06-06 15:45:48 -07001004.RS 4
1005Do not use shared class data\&. This is the default value for Java HotSpot 32\-Bit Server VM, Java HotSpot 64\-Bit Client VM, and Java HotSpot 64\-Bit Server VM\&.
1006.RE
1007.PP
rgallardb6435452013-11-25 20:19:02 -08001008dump
rgallard36ba8532014-06-06 15:45:48 -07001009.RS 4
rgallardb6435452013-11-25 20:19:02 -08001010Manually generate the class data sharing archive\&.
rgallard36ba8532014-06-06 15:45:48 -07001011.RE
1012.RE
1013.PP
1014\-XshowSettings:\fIcategory\fR
1015.RS 4
1016Shows settings and continues\&. Possible
1017\fIcategory\fR
1018arguments for this option include the following:
1019.PP
rgallardb6435452013-11-25 20:19:02 -08001020all
rgallard36ba8532014-06-06 15:45:48 -07001021.RS 4
rgallardb6435452013-11-25 20:19:02 -08001022Shows all categories of settings\&. This is the default value\&.
rgallard36ba8532014-06-06 15:45:48 -07001023.RE
1024.PP
rgallardb6435452013-11-25 20:19:02 -08001025locale
rgallard36ba8532014-06-06 15:45:48 -07001026.RS 4
rgallardb6435452013-11-25 20:19:02 -08001027Shows settings related to locale\&.
rgallard36ba8532014-06-06 15:45:48 -07001028.RE
1029.PP
rgallardb6435452013-11-25 20:19:02 -08001030properties
rgallard36ba8532014-06-06 15:45:48 -07001031.RS 4
rgallardb6435452013-11-25 20:19:02 -08001032Shows settings related to system properties\&.
rgallard36ba8532014-06-06 15:45:48 -07001033.RE
1034.PP
rgallardb6435452013-11-25 20:19:02 -08001035vm
rgallard36ba8532014-06-06 15:45:48 -07001036.RS 4
rgallardb6435452013-11-25 20:19:02 -08001037Shows the settings of the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -07001038.RE
1039.RE
1040.PP
1041\-Xss\fIsize\fR
1042.RS 4
1043Sets the thread stack size (in bytes)\&. Append the letter
1044\fBk\fR
1045or
1046\fBK\fR
1047to indicate KB,
1048\fBm\fR
1049or
1050\fBM\fR
1051to indicate MB,
1052\fBg\fR
1053or
1054\fBG\fR
1055to indicate GB\&. The default value depends on the platform:
1056.sp
1057.RS 4
1058.ie n \{\
1059\h'-04'\(bu\h'+03'\c
1060.\}
1061.el \{\
1062.sp -1
1063.IP \(bu 2.3
1064.\}
1065Linux/ARM (32\-bit): 320 KB
1066.RE
1067.sp
1068.RS 4
1069.ie n \{\
1070\h'-04'\(bu\h'+03'\c
1071.\}
1072.el \{\
1073.sp -1
1074.IP \(bu 2.3
1075.\}
1076Linux/i386 (32\-bit): 320 KB
1077.RE
1078.sp
1079.RS 4
1080.ie n \{\
1081\h'-04'\(bu\h'+03'\c
1082.\}
1083.el \{\
1084.sp -1
1085.IP \(bu 2.3
1086.\}
1087Linux/x64 (64\-bit): 1024 KB
1088.RE
1089.sp
1090.RS 4
1091.ie n \{\
1092\h'-04'\(bu\h'+03'\c
1093.\}
1094.el \{\
1095.sp -1
1096.IP \(bu 2.3
1097.\}
1098OS X (64\-bit): 1024 KB
1099.RE
1100.sp
1101.RS 4
1102.ie n \{\
1103\h'-04'\(bu\h'+03'\c
1104.\}
1105.el \{\
1106.sp -1
1107.IP \(bu 2.3
1108.\}
1109Oracle Solaris/i386 (32\-bit): 320 KB
1110.RE
1111.sp
1112.RS 4
1113.ie n \{\
1114\h'-04'\(bu\h'+03'\c
1115.\}
1116.el \{\
1117.sp -1
1118.IP \(bu 2.3
1119.\}
1120Oracle Solaris/x64 (64\-bit): 1024 KB
1121.RE
1122.sp
1123.RS 4
1124.ie n \{\
1125\h'-04'\(bu\h'+03'\c
1126.\}
1127.el \{\
1128.sp -1
1129.IP \(bu 2.3
1130.\}
rgallardb6435452013-11-25 20:19:02 -08001131Windows: depends on virtual memory
duke6e45e102007-12-01 00:00:00 +00001132.RE
rgallard36ba8532014-06-06 15:45:48 -07001133.sp
rgallardb6435452013-11-25 20:19:02 -08001134The following examples set the thread stack size to 1024 KB in different units:
rgallard36ba8532014-06-06 15:45:48 -07001135.sp
1136.if n \{\
1137.RS 4
1138.\}
1139.nf
1140\fB\-Xss1m\fR
1141\fB\-Xss1024k\fR
1142\fB\-Xss1048576\fR
1143
1144.fi
1145.if n \{\
duke6e45e102007-12-01 00:00:00 +00001146.RE
rgallard36ba8532014-06-06 15:45:48 -07001147.\}
1148This option is equivalent to
1149\fB\-XX:ThreadStackSize\fR\&.
1150.RE
1151.PP
1152\-Xusealtsigs
1153.RS 4
1154Use alternative signals instead of
1155\fBSIGUSR1\fR
1156and
1157\fBSIGUSR2\fR
1158for JVM internal signals\&. This option is equivalent to
1159\fB\-XX:+UseAltSigs\fR\&.
1160.RE
1161.PP
1162\-Xverify:\fImode\fR
1163.RS 4
1164Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible
1165\fImode\fR
1166arguments for this option include the following:
1167.PP
rgallardb6435452013-11-25 20:19:02 -08001168none
rgallard36ba8532014-06-06 15:45:48 -07001169.RS 4
rgallardb6435452013-11-25 20:19:02 -08001170Do not verify the bytecode\&. This reduces startup time and also reduces the protection provided by Java\&.
rgallard36ba8532014-06-06 15:45:48 -07001171.RE
1172.PP
rgallardb6435452013-11-25 20:19:02 -08001173remote
rgallard36ba8532014-06-06 15:45:48 -07001174.RS 4
1175Verify only those classes that are loaded remotely over the network\&. This is the default behavior if you do not specify the
1176\fB\-Xverify\fR
1177option\&.
1178.RE
1179.PP
rgallardb6435452013-11-25 20:19:02 -08001180all
rgallard36ba8532014-06-06 15:45:48 -07001181.RS 4
rgallardb6435452013-11-25 20:19:02 -08001182Verify all classes\&.
rgallard36ba8532014-06-06 15:45:48 -07001183.RE
1184.RE
1185.SS "Advanced Runtime Options"
1186.PP
rgallardb6435452013-11-25 20:19:02 -08001187These options control the runtime behavior of the Java HotSpot VM\&.
rgallard36ba8532014-06-06 15:45:48 -07001188.PP
1189\-XX:+DisableAttachMechanism
1190.RS 4
1191Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as
1192\fBjcmd\fR,
1193\fBjstack\fR,
1194\fBjmap\fR, and
1195\fBjinfo\fR\&.
1196.RE
1197.PP
1198\-XX:ErrorFile=\fIfilename\fR
1199.RS 4
1200Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named
1201\fBhs_err_pid\fR\fIpid\fR\fB\&.log\fR
1202where
1203\fIpid\fR
1204is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as
1205\fB%p\fR):
1206.sp
1207.if n \{\
1208.RS 4
1209.\}
1210.nf
1211\fB\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fR
1212
1213.fi
1214.if n \{\
1215.RE
1216.\}
1217The following example shows how to set the error log to
1218\fB/var/log/java/java_error\&.log\fR:
1219.sp
1220.if n \{\
1221.RS 4
1222.\}
1223.nf
1224\fB\-XX:ErrorFile=/var/log/java/java_error\&.log\fR
1225
1226.fi
1227.if n \{\
1228.RE
1229.\}
1230If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is
1231\fB/tmp\fR\&.
1232.RE
1233.PP
1234\-XX:+FailOverToOldVerifier
1235.RS 4
1236Enables automatic failover to the old verifier when the new type checker fails\&. By default, this option is disabled and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
1237.RE
1238.PP
1239\-XX:LargePageSizeInBytes=\fIsize\fR
1240.RS 4
1241Sets the maximum size (in bytes) for large pages used for Java heap\&. The
1242\fIsize\fR
1243argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter
1244\fBk\fR
1245or
1246\fBK\fR
1247to indicate kilobytes,
1248\fBm\fR
1249or
1250\fBM\fR
1251to indicate megabytes,
1252\fBg\fR
1253or
1254\fBG\fR
1255to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
1256.sp
rgallardb6435452013-11-25 20:19:02 -08001257The following example illustrates how to set the large page size to 4 megabytes (MB):
rgallard36ba8532014-06-06 15:45:48 -07001258.sp
1259.if n \{\
1260.RS 4
1261.\}
1262.nf
1263\fB\-XX:LargePageSizeInBytes=4m\fR
1264
1265.fi
1266.if n \{\
1267.RE
1268.\}
1269.RE
1270.PP
1271\-XX:MaxDirectMemorySize=\fIsize\fR
1272.RS 4
1273Sets the maximum total size (in bytes) of the New I/O (the
1274\fBjava\&.nio\fR
1275package) direct\-buffer allocations\&. Append the letter
1276\fBk\fR
1277or
1278\fBK\fR
1279to indicate kilobytes,
1280\fBm\fR
1281or
1282\fBM\fR
1283to indicate megabytes,
1284\fBg\fR
1285or
1286\fBG\fR
1287to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct\-buffer allocations automatically\&.
1288.sp
rgallardb6435452013-11-25 20:19:02 -08001289The following examples illustrate how to set the NIO size to 1024 KB in different units:
rgallard36ba8532014-06-06 15:45:48 -07001290.sp
1291.if n \{\
1292.RS 4
1293.\}
1294.nf
1295\fB\-XX:MaxDirectMemorySize=1m\fR
1296\fB\-XX:MaxDirectMemorySize=1024k\fR
1297\fB\-XX:MaxDirectMemorySize=1048576\fR
1298
1299.fi
1300.if n \{\
1301.RE
1302.\}
1303.RE
1304.PP
1305\-XX:NativeMemoryTracking=\fImode\fR
1306.RS 4
1307Specifies the mode for tracking JVM native memory usage\&. Possible
1308\fImode\fR
1309arguments for this option include the following:
1310.PP
rgallardb6435452013-11-25 20:19:02 -08001311off
rgallard36ba8532014-06-06 15:45:48 -07001312.RS 4
1313Do not track JVM native memory usage\&. This is the default behavior if you do not specify the
1314\fB\-XX:NativeMemoryTracking\fR
1315option\&.
1316.RE
1317.PP
rgallardb6435452013-11-25 20:19:02 -08001318summary
rgallard36ba8532014-06-06 15:45:48 -07001319.RS 4
rgallardb6435452013-11-25 20:19:02 -08001320Only track memory usage by JVM subsystems, such as Java heap, class, code, and thread\&.
rgallard36ba8532014-06-06 15:45:48 -07001321.RE
1322.PP
rgallardb6435452013-11-25 20:19:02 -08001323detail
rgallard36ba8532014-06-06 15:45:48 -07001324.RS 4
1325In addition to tracking memory usage by JVM subsystems, track memory usage by individual
1326\fBCallSite\fR, individual virtual memory region and its committed regions\&.
1327.RE
1328.RE
1329.PP
1330\-XX:OnError=\fIstring\fR
1331.RS 4
1332Sets a custom command or a series of semicolon\-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
1333.sp
1334The following example shows how the
1335\fB\-XX:OnError\fR
1336option can be used to run the
1337\fBgcore\fR
1338command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the
1339\fB%p\fR
1340designates the current process):
1341.sp
1342.if n \{\
1343.RS 4
1344.\}
1345.nf
1346\fB\-XX:OnError="gcore %p;dbx \- %p"\fR
1347
1348.fi
1349.if n \{\
1350.RE
1351.\}
1352.RE
1353.PP
1354\-XX:OnOutOfMemoryError=\fIstring\fR
1355.RS 4
1356Sets a custom command or a series of semicolon\-separated commands to run when an
1357\fBOutOfMemoryError\fR
1358exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the
1359\fB\-XX:OnError\fR
1360option\&.
1361.RE
1362.PP
1363\-XX:+PrintCommandLineFlags
1364.RS 4
rgallardb6435452013-11-25 20:19:02 -08001365Enables printing of ergonomically selected JVM flags that appeared on the command line\&. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector\&. By default, this option is disabled and flags are not printed\&.
rgallard36ba8532014-06-06 15:45:48 -07001366.RE
1367.PP
1368\-XX:+PrintNMTStatistics
1369.RS 4
1370Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see
1371\fB\-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
1372.RE
1373.PP
1374\-XX:+RelaxAccessControlCheck
1375.RS 4
1376Decreases the amount of access control checks in the verifier\&. By default, this option is disabled, and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
1377.RE
1378.PP
1379\-XX:+ShowMessageBoxOnError
1380.RS 4
rgallardb6435452013-11-25 20:19:02 -08001381Enables displaying of a dialog box when the JVM experiences an irrecoverable error\&. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07001382.RE
1383.PP
1384\-XX:ThreadStackSize=\fIsize\fR
1385.RS 4
1386Sets the thread stack size (in bytes)\&. Append the letter
1387\fBk\fR
1388or
1389\fBK\fR
1390to indicate kilobytes,
1391\fBm\fR
1392or
1393\fBM\fR
1394to indicate megabytes,
1395\fBg\fR
1396or
1397\fBG\fR
1398to indicate gigabytes\&. The default value depends on the platform:
1399.sp
1400.RS 4
1401.ie n \{\
1402\h'-04'\(bu\h'+03'\c
1403.\}
1404.el \{\
1405.sp -1
1406.IP \(bu 2.3
1407.\}
1408Linux/ARM (32\-bit): 320 KB
1409.RE
1410.sp
1411.RS 4
1412.ie n \{\
1413\h'-04'\(bu\h'+03'\c
1414.\}
1415.el \{\
1416.sp -1
1417.IP \(bu 2.3
1418.\}
1419Linux/i386 (32\-bit): 320 KB
1420.RE
1421.sp
1422.RS 4
1423.ie n \{\
1424\h'-04'\(bu\h'+03'\c
1425.\}
1426.el \{\
1427.sp -1
1428.IP \(bu 2.3
1429.\}
1430Linux/x64 (64\-bit): 1024 KB
1431.RE
1432.sp
1433.RS 4
1434.ie n \{\
1435\h'-04'\(bu\h'+03'\c
1436.\}
1437.el \{\
1438.sp -1
1439.IP \(bu 2.3
1440.\}
1441OS X (64\-bit): 1024 KB
1442.RE
1443.sp
1444.RS 4
1445.ie n \{\
1446\h'-04'\(bu\h'+03'\c
1447.\}
1448.el \{\
1449.sp -1
1450.IP \(bu 2.3
1451.\}
1452Oracle Solaris/i386 (32\-bit): 320 KB
1453.RE
1454.sp
1455.RS 4
1456.ie n \{\
1457\h'-04'\(bu\h'+03'\c
1458.\}
1459.el \{\
1460.sp -1
1461.IP \(bu 2.3
1462.\}
1463Oracle Solaris/x64 (64\-bit): 1024 KB
1464.RE
1465.sp
1466.RS 4
1467.ie n \{\
1468\h'-04'\(bu\h'+03'\c
1469.\}
1470.el \{\
1471.sp -1
1472.IP \(bu 2.3
1473.\}
rgallardb6435452013-11-25 20:19:02 -08001474Windows: depends on virtual memory
duke6e45e102007-12-01 00:00:00 +00001475.RE
rgallard36ba8532014-06-06 15:45:48 -07001476.sp
rgallardb6435452013-11-25 20:19:02 -08001477The following examples show how to set the thread stack size to 1024 KB in different units:
rgallard36ba8532014-06-06 15:45:48 -07001478.sp
1479.if n \{\
1480.RS 4
1481.\}
1482.nf
1483\fB\-XX:ThreadStackSize=1m\fR
1484\fB\-XX:ThreadStackSize=1024k\fR
1485\fB\-XX:ThreadStackSize=1048576\fR
1486
1487.fi
1488.if n \{\
rgallardb6435452013-11-25 20:19:02 -08001489.RE
rgallard36ba8532014-06-06 15:45:48 -07001490.\}
1491This option is equivalent to
1492\fB\-Xss\fR\&.
1493.RE
1494.PP
1495\-XX:+TraceClassLoading
1496.RS 4
rgallardb6435452013-11-25 20:19:02 -08001497Enables tracing of classes as they are loaded\&. By default, this option is disabled and classes are not traced\&.
rgallard36ba8532014-06-06 15:45:48 -07001498.RE
1499.PP
1500\-XX:+TraceClassLoadingPreorder
1501.RS 4
rgallardb6435452013-11-25 20:19:02 -08001502Enables tracing of all loaded classes in the order in which they are referenced\&. By default, this option is disabled and classes are not traced\&.
rgallard36ba8532014-06-06 15:45:48 -07001503.RE
1504.PP
1505\-XX:+TraceClassResolution
1506.RS 4
rgallardb6435452013-11-25 20:19:02 -08001507Enables tracing of constant pool resolutions\&. By default, this option is disabled and constant pool resolutions are not traced\&.
rgallard36ba8532014-06-06 15:45:48 -07001508.RE
1509.PP
1510\-XX:+TraceClassUnloading
1511.RS 4
rgallardb6435452013-11-25 20:19:02 -08001512Enables tracing of classes as they are unloaded\&. By default, this option is disabled and classes are not traced\&.
rgallard36ba8532014-06-06 15:45:48 -07001513.RE
1514.PP
1515\-XX:+TraceLoaderConstraints
1516.RS 4
1517Enables tracing of the loader constraints recording\&. By default, this option is disabled and loader constraints recording is not traced\&.
1518.RE
1519.PP
1520\-XX:+UseAltSigs
1521.RS 4
1522Enables the use of alternative signals instead of
1523\fBSIGUSR1\fR
1524and
1525\fBSIGUSR2\fR
1526for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to
1527\fB\-Xusealtsigs\fR\&.
1528.RE
1529.PP
1530\-XX:\-UseBiasedLocking
1531.RS 4
1532Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning\-139912\&.html#section4\&.2\&.5
1533.sp
1534By default, this option is enabled\&.
1535.RE
1536.PP
1537\-XX:\-UseCompressedOops
1538.RS 4
1539Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32\-bit offsets instead of 64\-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64\-bit JVMs\&.
1540.RE
1541.PP
1542\-XX:\-UseLargePages
1543.RS 4
1544Disables the use of large page memory\&. This option is enabled by default\&.
1545.sp
1546For more information, see Java Support for Large Memory Pages at http://www\&.oracle\&.com/technetwork/java/javase/tech/largememory\-jsp\-137182\&.html
1547.RE
1548.PP
1549\-XX:+UseMembar
1550.RS 4
1551Enables issuing of membars on thread state transitions\&. This option is disabled by default on all platforms except ARM servers, where it is enabled\&. (It is recommended that you do not disable this option on ARM servers\&.)
1552.RE
1553.PP
1554\-XX:+UsePerfData
1555.RS 4
1556Enables the
1557\fBperfdata\fR
1558feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the
1559\fBhsperfdata_userid\fR
1560directories\&. To disable the
1561\fBperfdata\fR
1562feature, specify
1563\fB\-XX:\-UsePerfData\fR\&.
1564.RE
1565.PP
1566\-XX:+AllowUserSignalHandlers
1567.RS 4
rgallardb6435452013-11-25 20:19:02 -08001568Enables installation of signal handlers by the application\&. By default, this option is disabled and the application is not allowed to install signal handlers\&.
rgallard36ba8532014-06-06 15:45:48 -07001569.RE
1570.SS "Advanced JIT Compiler Options"
1571.PP
1572These options control the dynamic just\-in\-time (JIT) compilation performed by the Java HotSpot VM\&.
1573.PP
1574\-XX:+AggressiveOpts
1575.RS 4
rgallardb6435452013-11-25 20:19:02 -08001576Enables the use of aggressive performance optimization features, which are expected to become default in upcoming releases\&. By default, this option is disabled and experimental performance features are not used\&.
rgallard36ba8532014-06-06 15:45:48 -07001577.RE
1578.PP
1579\-XX:AllocateInstancePrefetchLines=\fIlines\fR
1580.RS 4
rgallardb6435452013-11-25 20:19:02 -08001581Sets the number of lines to prefetch ahead of the instance allocation pointer\&. By default, the number of lines to prefetch is set to 1:
rgallard36ba8532014-06-06 15:45:48 -07001582.sp
1583.if n \{\
1584.RS 4
1585.\}
1586.nf
1587\fB\-XX:AllocateInstancePrefetchLines=1\fR
1588
1589.fi
1590.if n \{\
1591.RE
1592.\}
1593Only the Java HotSpot Server VM supports this option\&.
1594.RE
1595.PP
1596\-XX:AllocatePrefetchDistance=\fIsize\fR
1597.RS 4
rgallardb6435452013-11-25 20:19:02 -08001598Sets the size (in bytes) of the prefetch distance for object allocation\&. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object\&. Each Java thread has its own allocation point\&.
rgallard36ba8532014-06-06 15:45:48 -07001599.sp
1600Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter
1601\fBk\fR
1602or
1603\fBK\fR
1604to indicate kilobytes,
1605\fBm\fR
1606or
1607\fBM\fR
1608to indicate megabytes,
1609\fBg\fR
1610or
1611\fBG\fR
1612to indicate gigabytes\&. The default value is set to \-1\&.
1613.sp
rgallardb6435452013-11-25 20:19:02 -08001614The following example shows how to set the prefetch distance to 1024 bytes:
rgallard36ba8532014-06-06 15:45:48 -07001615.sp
1616.if n \{\
1617.RS 4
1618.\}
1619.nf
1620\fB\-XX:AllocatePrefetchDistance=1024\fR
1621
1622.fi
1623.if n \{\
1624.RE
1625.\}
1626Only the Java HotSpot Server VM supports this option\&.
1627.RE
1628.PP
1629\-XX:AllocatePrefetchInstr=\fIinstruction\fR
1630.RS 4
1631Sets the prefetch instruction to prefetch ahead of the allocation pointer\&. Only the Java HotSpot Server VM supports this option\&. Possible values are from 0 to 3\&. The actual instructions behind the values depend on the platform\&. By default, the prefetch instruction is set to 0:
1632.sp
1633.if n \{\
1634.RS 4
1635.\}
1636.nf
1637\fB\-XX:AllocatePrefetchInstr=0\fR
1638
1639.fi
1640.if n \{\
1641.RE
1642.\}
1643Only the Java HotSpot Server VM supports this option\&.
1644.RE
1645.PP
1646\-XX:AllocatePrefetchLines=\fIlines\fR
1647.RS 4
rgallardb6435452013-11-25 20:19:02 -08001648Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code\&. The default value is 1 if the last allocated object was an instance, and 3 if it was an array\&.
rgallard36ba8532014-06-06 15:45:48 -07001649.sp
rgallardb6435452013-11-25 20:19:02 -08001650The following example shows how to set the number of loaded cache lines to 5:
rgallard36ba8532014-06-06 15:45:48 -07001651.sp
1652.if n \{\
1653.RS 4
1654.\}
1655.nf
1656\fB\-XX:AllocatePrefetchLines=5\fR
1657
1658.fi
1659.if n \{\
1660.RE
1661.\}
1662Only the Java HotSpot Server VM supports this option\&.
1663.RE
1664.PP
1665\-XX:AllocatePrefetchStepSize=\fIsize\fR
1666.RS 4
1667Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter
1668\fBk\fR
1669or
1670\fBK\fR
1671to indicate kilobytes,
1672\fBm\fR
1673or
1674\fBM\fR
1675to indicate megabytes,
1676\fBg\fR
1677or
1678\fBG\fR
1679to indicate gigabytes\&. By default, the step size is set to 16 bytes:
1680.sp
1681.if n \{\
1682.RS 4
1683.\}
1684.nf
1685\fB\-XX:AllocatePrefetchStepSize=16\fR
1686
1687.fi
1688.if n \{\
1689.RE
1690.\}
1691Only the Java HotSpot Server VM supports this option\&.
1692.RE
1693.PP
1694\-XX:AllocatePrefetchStyle=\fIstyle\fR
1695.RS 4
1696Sets the generated code style for prefetch instructions\&. The
1697\fIstyle\fR
1698argument is an integer from 0 to 3:
1699.PP
rgallardb6435452013-11-25 20:19:02 -080017000
rgallard36ba8532014-06-06 15:45:48 -07001701.RS 4
rgallardb6435452013-11-25 20:19:02 -08001702Do not generate prefetch instructions\&.
rgallard36ba8532014-06-06 15:45:48 -07001703.RE
1704.PP
rgallardb6435452013-11-25 20:19:02 -080017051
rgallard36ba8532014-06-06 15:45:48 -07001706.RS 4
rgallardb6435452013-11-25 20:19:02 -08001707Execute prefetch instructions after each allocation\&. This is the default parameter\&.
rgallard36ba8532014-06-06 15:45:48 -07001708.RE
1709.PP
rgallardb6435452013-11-25 20:19:02 -080017102
rgallard36ba8532014-06-06 15:45:48 -07001711.RS 4
1712Use the thread\-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
1713.RE
1714.PP
rgallardb6435452013-11-25 20:19:02 -080017153
rgallard36ba8532014-06-06 15:45:48 -07001716.RS 4
rgallardb6435452013-11-25 20:19:02 -08001717Use BIS instruction on SPARC for allocation prefetch\&.
rgallard36ba8532014-06-06 15:45:48 -07001718.RE
1719.sp
1720Only the Java HotSpot Server VM supports this option\&.
1721.RE
1722.PP
1723\-XX:+BackgroundCompilation
1724.RS 4
1725Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify
1726\fB\-XX:\-BackgroundCompilation\fR
1727(this is equivalent to specifying
1728\fB\-Xbatch\fR)\&.
1729.RE
1730.PP
1731\-XX:CICompilerCount=\fIthreads\fR
1732.RS 4
1733Sets the number of compiler threads to use for compilation\&. By default, the number of threads is set to 2 for the server JVM, to 1 for the client JVM, and it scales to the number of cores if tiered compilation is used\&. The following example shows how to set the number of threads to 2:
1734.sp
1735.if n \{\
1736.RS 4
1737.\}
1738.nf
1739\fB\-XX:CICompilerCount=2\fR
1740
1741.fi
1742.if n \{\
1743.RE
1744.\}
1745.RE
1746.PP
1747\-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
1748.RS 4
1749Sets the minimum free space (in bytes) required for compilation\&. Append the letter
1750\fBk\fR
1751or
1752\fBK\fR
1753to indicate kilobytes,
1754\fBm\fR
1755or
1756\fBM\fR
1757to indicate megabytes,
1758\fBg\fR
1759or
1760\fBG\fR
1761to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
1762.sp
1763.if n \{\
1764.RS 4
1765.\}
1766.nf
1767\fB\-XX:CodeCacheMinimumFreeSpace=1024m\fR
1768
1769.fi
1770.if n \{\
1771.RE
1772.\}
1773.RE
1774.PP
1775\-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
1776.RS 4
1777Specifies a command to perform on a method\&. For example, to exclude the
1778\fBindexOf()\fR
1779method of the
1780\fBString\fR
1781class from being compiled, use the following:
1782.sp
1783.if n \{\
1784.RS 4
1785.\}
1786.nf
1787\fB\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fR
1788
1789.fi
1790.if n \{\
1791.RE
1792.\}
1793Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
1794\fB\-XX:+PrintCompilation\fR
1795and
1796\fB\-XX:+LogCompilation\fR
1797options:
1798.sp
1799.if n \{\
1800.RS 4
1801.\}
1802.nf
1803\fB\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fR
1804
1805.fi
1806.if n \{\
1807.RE
1808.\}
1809If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the
1810\fBindexOf(String)\fR
1811method of the
1812\fBString\fR
1813class from being compiled, use the following:
1814.sp
1815.if n \{\
1816.RS 4
1817.\}
1818.nf
1819\fB\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fR
1820
1821.fi
1822.if n \{\
1823.RE
1824.\}
1825You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all
1826\fBindexOf()\fR
1827methods in all classes from being compiled, use the following:
1828.sp
1829.if n \{\
1830.RS 4
1831.\}
1832.nf
1833\fB\-XX:CompileCommand=exclude,*\&.indexOf\fR
1834
1835.fi
1836.if n \{\
1837.RE
1838.\}
1839The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to
1840\fB\-XX:CompileCommand\fR
1841using spaces as separators by enclosing the argument in quotation marks:
1842.sp
1843.if n \{\
1844.RS 4
1845.\}
1846.nf
1847\fB\-XX:CompileCommand="exclude java/lang/String indexOf"\fR
1848
1849.fi
1850.if n \{\
1851.RE
1852.\}
1853Note that after parsing the commands passed on the command line using the
1854\fB\-XX:CompileCommand\fR
1855options, the JIT compiler then reads commands from the
1856\fB\&.hotspot_compiler\fR
1857file\&. You can add commands to this file or specify a different file using the
1858\fB\-XX:CompileCommandFile\fR
1859option\&.
1860.sp
1861To add several commands, either specify the
1862\fB\-XX:CompileCommand\fR
1863option multiple times, or separate each argument with the newline separator (\fB\en\fR)\&. The following commands are available:
1864.PP
1865break
1866.RS 4
1867Set a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method\&.
1868.RE
1869.PP
1870compileonly
1871.RS 4
1872Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the
1873\fB\-XX:CompileOnly\fR
1874option, which allows to specify several methods\&.
1875.RE
1876.PP
1877dontinline
1878.RS 4
1879Prevent inlining of the specified method\&.
1880.RE
1881.PP
1882exclude
1883.RS 4
1884Exclude the specified method from compilation\&.
1885.RE
1886.PP
1887help
1888.RS 4
1889Print a help message for the
1890\fB\-XX:CompileCommand\fR
1891option\&.
1892.RE
1893.PP
1894inline
1895.RS 4
1896Attempt to inline the specified method\&.
1897.RE
1898.PP
1899log
1900.RS 4
1901Exclude compilation logging (with the
1902\fB\-XX:+LogCompilation\fR
1903option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
1904.RE
1905.PP
1906option
1907.RS 4
1908This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the
1909\fBBlockLayoutByFrequency\fR
1910option for the
1911\fBappend()\fR
1912method of the
1913\fBStringBuffer\fR
1914class, use the following:
1915.sp
1916.if n \{\
1917.RS 4
1918.\}
1919.nf
1920\fB\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fR
1921
1922.fi
1923.if n \{\
1924.RE
1925.\}
1926You can specify multiple compilation options, separated by commas or spaces\&.
1927.RE
1928.PP
1929print
1930.RS 4
1931Print generated assembler code after compilation of the specified method\&.
1932.RE
1933.PP
1934quiet
1935.RS 4
1936Do not print the compile commands\&. By default, the commands that you specify with the \-\fBXX:CompileCommand\fR
1937option are printed; for example, if you exclude from compilation the
1938\fBindexOf()\fR
1939method of the
1940\fBString\fR
1941class, then the following will be printed to standard output:
1942.sp
1943.if n \{\
1944.RS 4
1945.\}
1946.nf
1947\fBCompilerOracle: exclude java/lang/String\&.indexOf\fR
1948
1949.fi
1950.if n \{\
1951.RE
1952.\}
1953You can suppress this by specifying the
1954\fB\-XX:CompileCommand=quiet\fR
1955option before other
1956\fB\-XX:CompileCommand\fR
1957options\&.
1958.RE
1959.RE
1960.PP
1961\-XX:CompileCommandFile=\fIfilename\fR
1962.RS 4
1963Sets the file from which JIT compiler commands are read\&. By default, the
1964\fB\&.hotspot_compiler\fR
1965file is used to store commands performed by the JIT compiler\&.
1966.sp
1967Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the
1968\fBtoString()\fR
1969method of the
1970\fBString\fR
1971class:
1972.sp
1973.if n \{\
1974.RS 4
1975.\}
1976.nf
1977\fBprint java/lang/String toString\fR
1978
1979.fi
1980.if n \{\
1981.RE
1982.\}
1983For more information about specifying the commands for the JIT compiler to perform on methods, see the
1984\fB\-XX:CompileCommand\fR
1985option\&.
1986.RE
1987.PP
1988\-XX:CompileOnly=\fImethods\fR
1989.RS 4
1990Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the
1991\fBlength()\fR
1992method of the
1993\fBString\fR
1994class and the
1995\fBsize()\fR
1996method of the
1997\fBList\fR
1998class, use the following:
1999.sp
2000.if n \{\
2001.RS 4
2002.\}
2003.nf
2004\fB\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fR
2005
2006.fi
2007.if n \{\
2008.RE
2009.\}
2010Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
2011\fB\-XX:+PrintCompilation\fR
2012and
2013\fB\-XX:+LogCompilation\fR
2014options:
2015.sp
2016.if n \{\
2017.RS 4
2018.\}
2019.nf
2020\fB\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fR
2021
2022.fi
2023.if n \{\
2024.RE
2025.\}
2026Although wildcards are not supported, you can specify only the class or package name to compile all methods in that class or package, as well as specify just the method to compile methods with this name in any class:
2027.sp
2028.if n \{\
2029.RS 4
2030.\}
2031.nf
2032\fB\-XX:CompileOnly=java/lang/String\fR
2033\fB\-XX:CompileOnly=java/lang\fR
2034\fB\-XX:CompileOnly=\&.length\fR
2035
2036.fi
2037.if n \{\
2038.RE
2039.\}
2040.RE
2041.PP
2042\-XX:CompileThreshold=\fIinvocations\fR
2043.RS 4
2044Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. The following example shows how to set the number of interpreted method invocations to 5,000:
2045.sp
2046.if n \{\
2047.RS 4
2048.\}
2049.nf
2050\fB\-XX:CompileThreshold=5000\fR
2051
2052.fi
2053.if n \{\
2054.RE
2055.\}
2056You can completely disable interpretation of Java methods before compilation by specifying the
2057\fB\-Xcomp\fR
2058option\&.
2059.RE
2060.PP
2061\-XX:+DoEscapeAnalysis
2062.RS 4
2063Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify
2064\fB\-XX:\-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
2065.RE
2066.PP
2067\-XX:InitialCodeCacheSize=\fIsize\fR
2068.RS 4
2069Sets the initial code cache size (in bytes)\&. Append the letter
2070\fBk\fR
2071or
2072\fBK\fR
2073to indicate kilobytes,
2074\fBm\fR
2075or
2076\fBM\fR
2077to indicate megabytes,
2078\fBg\fR
2079or
2080\fBG\fR
2081to indicate gigabytes\&. The default value is set to 500 KB\&. The following example shows how to set the initial code cache size to 32 KB:
2082.sp
2083.if n \{\
2084.RS 4
2085.\}
2086.nf
2087\fB\-XX:InitialCodeCacheSize=32k\fR
2088
2089.fi
2090.if n \{\
2091.RE
2092.\}
2093.RE
2094.PP
2095\-XX:+Inline
2096.RS 4
2097Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify
2098\fB\-XX:\-Inline\fR\&.
2099.RE
2100.PP
2101\-XX:InlineSmallCode=\fIsize\fR
2102.RS 4
2103Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter
2104\fBk\fR
2105or
2106\fBK\fR
2107to indicate kilobytes,
2108\fBm\fR
2109or
2110\fBM\fR
2111to indicate megabytes,
2112\fBg\fR
2113or
2114\fBG\fR
2115to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
2116.sp
2117.if n \{\
2118.RS 4
2119.\}
2120.nf
2121\fB\-XX:InlineSmallCode=1000\fR
2122
2123.fi
2124.if n \{\
2125.RE
2126.\}
2127.RE
2128.PP
2129\-XX:+LogCompilation
2130.RS 4
2131Enables logging of compilation activity to a file named
2132\fBhotspot\&.log\fR
2133in the current working directory\&. You can specify a different log file path and name using the
2134\fB\-XX:LogFile\fR
2135option\&.
2136.sp
2137By default, this option is disabled and compilation activity is not logged\&. The
2138\fB\-XX:+LogCompilation\fR
2139option has to be used together with the
2140\fB\-XX:UnlockDiagnosticVMOptions\fR
2141option that unlocks diagnostic JVM options\&.
2142.sp
2143You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the
2144\fB\-XX:+PrintCompilation\fR
2145option\&.
2146.RE
2147.PP
2148\-XX:MaxInlineSize=\fIsize\fR
2149.RS 4
2150Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter
2151\fBk\fR
2152or
2153\fBK\fR
2154to indicate kilobytes,
2155\fBm\fR
2156or
2157\fBM\fR
2158to indicate megabytes,
2159\fBg\fR
2160or
2161\fBG\fR
2162to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
2163.sp
2164.if n \{\
2165.RS 4
2166.\}
2167.nf
2168\fB\-XX:MaxInlineSize=35\fR
2169
2170.fi
2171.if n \{\
2172.RE
2173.\}
2174.RE
2175.PP
2176\-XX:MaxNodeLimit=\fInodes\fR
2177.RS 4
2178Sets the maximum number of nodes to be used during single method compilation\&. By default, the maximum number of nodes is set to 65,000:
2179.sp
2180.if n \{\
2181.RS 4
2182.\}
2183.nf
2184\fB\-XX:MaxNodeLimit=65000\fR
2185
2186.fi
2187.if n \{\
2188.RE
2189.\}
2190.RE
2191.PP
2192\-XX:MaxTrivialSize=\fIsize\fR
2193.RS 4
2194Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter
2195\fBk\fR
2196or
2197\fBK\fR
2198to indicate kilobytes,
2199\fBm\fR
2200or
2201\fBM\fR
2202to indicate megabytes,
2203\fBg\fR
2204or
2205\fBG\fR
2206to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
2207.sp
2208.if n \{\
2209.RS 4
2210.\}
2211.nf
2212\fB\-XX:MaxTrivialSize=6\fR
2213
2214.fi
2215.if n \{\
2216.RE
2217.\}
2218.RE
2219.PP
2220\-XX:+OptimizeStringConcat
2221.RS 4
2222Enables the optimization of
2223\fBString\fR
2224concatenation operations\&. This option is enabled by default\&. To disable the optimization of
2225\fBString\fR
2226concatenation operations, specify
2227\fB\-XX:\-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
2228.RE
2229.PP
2230\-XX:+PrintAssembly
2231.RS 4
2232Enables printing of assembly code for bytecoded and native methods by using the external
2233\fBdisassembler\&.so\fR
2234library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
2235.sp
2236By default, this option is disabled and assembly code is not printed\&. The
2237\fB\-XX:+PrintAssembly\fR
2238option has to be used together with the
2239\fB\-XX:UnlockDiagnosticVMOptions\fR
2240option that unlocks diagnostic JVM options\&.
2241.RE
2242.PP
2243\-XX:+PrintCompilation
2244.RS 4
2245Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled\&. This enables you to see which methods actually get compiled\&. By default, this option is disabled and diagnostic output is not printed\&.
2246.sp
2247You can also log compilation activity to a file by using the
2248\fB\-XX:+LogCompilation\fR
2249option\&.
2250.RE
2251.PP
2252\-XX:+PrintInlining
2253.RS 4
2254Enables printing of inlining decisions\&. This enables you to see which methods are getting inlined\&.
2255.sp
2256By default, this option is disabled and inlining information is not printed\&. The
2257\fB\-XX:+PrintInlining\fR
2258option has to be used together with the
2259\fB\-XX:+UnlockDiagnosticVMOptions\fR
2260option that unlocks diagnostic JVM options\&.
2261.RE
2262.PP
2263\-XX:ReservedCodeCacheSize=\fIsize\fR
2264.RS 4
2265Sets the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
2266\fBk\fR
2267or
2268\fBK\fR
2269to indicate kilobytes,
2270\fBm\fR
2271or
2272\fBM\fR
2273to indicate megabytes,
2274\fBg\fR
2275or
2276\fBG\fR
2277to indicate gigabytes\&. This option is equivalent to
2278\fB\-Xmaxjitcodesize\fR\&.
2279.RE
2280.PP
2281\-XX:+TieredCompilation
2282.RS 4
2283Enables the use of tiered compilation\&. By default, this option is enabled\&. Only the Java HotSpot Server VM supports this option\&.
2284.RE
2285.PP
2286\-XX:+UseAES
2287.RS 4
2288Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
2289.RE
2290.PP
2291\-XX:+UseAESIntrinsics
2292.RS 4
2293UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32\-bit and 64\-bit\&. To disable hardware\-based AES intrinsics, specify
2294\fB\-XX:\-UseAES \-XX:\-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
2295.sp
2296.if n \{\
2297.RS 4
2298.\}
2299.nf
2300\fB\-XX:+UseAES \-XX:+UseAESIntrinsics\fR
2301
2302.fi
2303.if n \{\
2304.RE
2305.\}
2306To support UseAES and UseAESIntrinsics flags for 32\-bit and 64\-bit use
2307\fB\-server\fR
2308option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
2309.RE
2310.PP
2311\-XX:+UseCodeCacheFlushing
2312.RS 4
2313Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify
2314\fB\-XX:\-UseCodeCacheFlushing\fR\&.
2315.RE
2316.PP
2317\-XX:+UseCondCardMark
2318.RS 4
2319Enables checking of whether the card is already marked before updating the card table\&. This option is disabled by default and should only be used on machines with multiple sockets, where it will increase performance of Java applications that rely heavily on concurrent operations\&. Only the Java HotSpot Server VM supports this option\&.
2320.RE
2321.PP
2322\-XX:+UseSuperWord
2323.RS 4
2324Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify
2325\fB\-XX:\-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
2326.RE
2327.SS "Experimental JIT Compiler Options"
2328.PP
2329The options related to the Restricted Transactional Memory (RTM) locking feature in this section are experimental and are not officially supported in Java SE 8u20; you must enable the
2330\fB\-XX:+UnlockExperimentalVMOptions\fR
2331option to use them\&. These options are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
2332.PP
2333\-XX:RTMAbortRatio=\fIabort_ratio\fR
2334.RS 4
2335The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the
2336\fB\-XX:+UseRTMDeopt\fR
2337option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
2338.RE
2339.PP
2340\-XX:RTMRetryCount=\fInumber_of_retries\fR
2341.RS 4
2342RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The
2343\fB\-XX:UseRTMLocking\fR
2344option must be enabled\&.
2345.RE
2346.PP
2347\-XX:+UseRTMDeopt
2348.RS 4
2349Auto\-tunes RTM locking depending on the abort ratio\&. This ratio is specified by
2350\fB\-XX:RTMAbortRatio\fR
2351option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The
2352\fB\-XX:UseRTMLocking\fR
2353option must be enabled\&.
2354.RE
2355.PP
2356\-XX:+UseRTMLocking
2357.RS 4
2358Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&.
2359.sp
2360RTM is part of Intel\*(Aqs Transactional Synchronization Extensions (TSX), which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions
2361\fBXBEGIN\fR,
2362\fBXABORT\fR,
2363\fBXEND\fR, and
2364\fBXTEST\fR\&. The
2365\fBXBEGIN\fR
2366and
2367\fBXEND\fR
2368instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the
2369\fBXEND\fR
2370instruction\&. The
2371\fBXABORT\fR
2372instruction can be used to explicitly abort a transaction and the
2373\fBXEND\fR
2374instruction to check if a set of instructions are being run in a transaction\&.
2375.sp
2376A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\*(Aqs system\&.
2377.sp
2378RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse\-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse\-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine\-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping\-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
2379.RE
2380.SS "Advanced Serviceability Options"
2381.PP
2382These options provide the ability to gather system information and perform extensive debugging\&.
2383.PP
2384\-XX:+ExtendedDTraceProbes
2385.RS 4
2386Enables additional
2387\fBdtrace\fR
2388tool probes that impact the performance\&. By default, this option is disabled and
2389\fBdtrace\fR
2390performs only standard probes\&.
2391.RE
2392.PP
2393\-XX:+HeapDumpOnOutOfMemory
2394.RS 4
2395Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a
2396\fBjava\&.lang\&.OutOfMemoryError\fR
2397exception is thrown\&. You can explicitly set the heap dump file path and name using the
2398\fB\-XX:HeapDumpPath\fR
2399option\&. By default, this option is disabled and the heap is not dumped when an
2400\fBOutOfMemoryError\fR
2401exception is thrown\&.
2402.RE
2403.PP
2404\-XX:HeapDumpPath=\fIpath\fR
2405.RS 4
2406Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the
2407\fB\-XX:+HeapDumpOnOutOfMemoryError\fR
2408option is set\&. By default, the file is created in the current working directory, and it is named
2409\fBjava_pid\fR\fIpid\fR\fB\&.hprof\fR
2410where
2411\fIpid\fR
2412is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\fB%p\fR
2413represents the current process identificator):
2414.sp
2415.if n \{\
2416.RS 4
2417.\}
2418.nf
2419\fB\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fR
2420
2421.fi
2422.if n \{\
2423.RE
2424.\}
2425The following example shows how to set the heap dump file to
2426\fB/var/log/java/java_heapdump\&.hprof\fR:
2427.sp
2428.if n \{\
2429.RS 4
2430.\}
2431.nf
2432\fB\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fR
2433
2434.fi
2435.if n \{\
2436.RE
2437.\}
2438.RE
2439.PP
2440\-XX:LogFile=\fIpath\fR
2441.RS 4
2442Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named
2443\fBhotspot\&.log\fR\&.
2444.sp
2445The following example shows how to set the log file to
2446\fB/var/log/java/hotspot\&.log\fR:
2447.sp
2448.if n \{\
2449.RS 4
2450.\}
2451.nf
2452\fB\-XX:LogFile=/var/log/java/hotspot\&.log\fR
2453
2454.fi
2455.if n \{\
2456.RE
2457.\}
2458.RE
2459.PP
2460\-XX:+PrintClassHistogram
2461.RS 4
2462Enables printing of a class instance histogram after a
2463\fBControl+C\fR
2464event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
2465.sp
2466Setting this option is equivalent to running the
2467\fBjmap \-histo\fR
2468command, or the
2469\fBjcmd \fR\fIpid\fR\fB GC\&.class_histogram\fR
2470command, where
2471\fIpid\fR
2472is the current Java process identifier\&.
2473.RE
2474.PP
2475\-XX:+PrintConcurrentLocks
2476.RS 4
2477Enables printing of j locks after a event\&. By default, this option is disabled\&.
2478.sp
2479Enables printing of j\fBava\&.util\&.concurrent\fR
2480locks after a
2481\fBControl+C\fR
2482event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
2483.sp
2484Setting this option is equivalent to running the
2485\fBjstack \-l\fR
2486command or the
2487\fBjcmd \fR\fIpid\fR\fB Thread\&.print \-l\fR
2488command, where
2489\fIpid\fR
2490is the current Java process identifier\&.
2491.RE
2492.PP
2493\-XX:+UnlockDiagnosticVMOptions
2494.RS 4
2495Unlocks the options intended for diagnosing the JVM\&. By default, this option is disabled and diagnostic options are not available\&.
2496.RE
2497.SS "Advanced Garbage Collection Options"
2498.PP
2499These options control how garbage collection (GC) is performed by the Java HotSpot VM\&.
2500.PP
2501\-XX:+AggressiveHeap
2502.RS 4
2503Enables Java heap optimization\&. This sets various parameters to be optimal for long\-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
2504.RE
2505.PP
2506\-XX:+AlwaysPreTouch
2507.RS 4
2508Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the
2509\fBmain()\fR
2510method\&. The option can be used in testing to simulate a long\-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
2511.RE
2512.PP
2513\-XX:+CMSClassUnloadingEnabled
2514.RS 4
2515Enables class unloading when using the concurrent mark\-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify
2516\fB\-XX:\-CMSClassUnloadingEnabled\fR\&.
2517.RE
2518.PP
2519\-XX:CMSExpAvgFactor=\fIpercent\fR
2520.RS 4
rgallardb6435452013-11-25 20:19:02 -08002521Sets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics\&. By default, the exponential averages factor is set to 25%\&. The following example shows how to set the factor to 15%:
rgallard36ba8532014-06-06 15:45:48 -07002522.sp
2523.if n \{\
2524.RS 4
2525.\}
2526.nf
2527\fB\-XX:CMSExpAvgFactor=15\fR
2528
2529.fi
2530.if n \{\
2531.RE
2532.\}
2533.RE
2534.PP
2535\-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
2536.RS 4
2537Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to \-1\&. Any negative value (including the default) implies that
2538\fB\-XX:CMSTriggerRatio\fR
2539is used to define the value of the initiating occupancy fraction\&.
2540.sp
rgallardb6435452013-11-25 20:19:02 -08002541The following example shows how to set the occupancy fraction to 20%:
rgallard36ba8532014-06-06 15:45:48 -07002542.sp
2543.if n \{\
2544.RS 4
2545.\}
2546.nf
2547\fB\-XX:CMSInitiatingOccupancyFraction=20\fR
2548
2549.fi
2550.if n \{\
2551.RE
2552.\}
2553.RE
2554.PP
2555\-XX:+CMSScavengeBeforeRemark
2556.RS 4
rgallardb6435452013-11-25 20:19:02 -08002557Enables scavenging attempts before the CMS remark step\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002558.RE
2559.PP
2560\-XX:CMSTriggerRatio=\fIpercent\fR
2561.RS 4
2562Sets the percentage (0 to 100) of the value specified by
2563\fB\-XX:MinHeapFreeRatio\fR
2564that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
2565.sp
rgallardb6435452013-11-25 20:19:02 -08002566The following example shows how to set the occupancy fraction to 75%:
rgallard36ba8532014-06-06 15:45:48 -07002567.sp
2568.if n \{\
2569.RS 4
2570.\}
2571.nf
2572\fB\-XX:CMSTriggerRatio=75\fR
2573
2574.fi
2575.if n \{\
2576.RE
2577.\}
2578.RE
2579.PP
2580\-XX:ConcGCThreads=\fIthreads\fR
2581.RS 4
rgallardb6435452013-11-25 20:19:02 -08002582Sets the number of threads used for concurrent GC\&. The default value depends on the number of CPUs available to the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -07002583.sp
rgallardb6435452013-11-25 20:19:02 -08002584For example, to set the number of threads for concurrent GC to 2, specify the following option:
rgallard36ba8532014-06-06 15:45:48 -07002585.sp
2586.if n \{\
2587.RS 4
2588.\}
2589.nf
2590\fB\-XX:ConcGCThreads=2\fR
2591
2592.fi
2593.if n \{\
2594.RE
2595.\}
2596.RE
2597.PP
2598\-XX:+DisableExplicitGC
2599.RS 4
2600Enables the option that disables processing of calls to
2601\fBSystem\&.gc()\fR\&. This option is disabled by default, meaning that calls to
2602\fBSystem\&.gc()\fR
2603are processed\&. If processing of calls to
2604\fBSystem\&.gc()\fR
2605is disabled, the JVM still performs GC when necessary\&.
2606.RE
2607.PP
2608\-XX:+ExplicitGCInvokesConcurrent
2609.RS 4
2610Enables invoking of concurrent GC by using the
2611\fBSystem\&.gc()\fR
2612request\&. This option is disabled by default and can be enabled only together with the
2613\fB\-XX:+UseConcMarkSweepGC\fR
2614option\&.
2615.RE
2616.PP
2617\-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
2618.RS 4
2619Enables invoking of concurrent GC by using the
2620\fBSystem\&.gc()\fR
2621request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the
2622\fB\-XX:+UseConcMarkSweepGC\fR
2623option\&.
2624.RE
2625.PP
2626\-XX:G1HeapRegionSize=\fIsize\fR
2627.RS 4
2628Sets the size of the regions into which the Java heap is subdivided when using the garbage\-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
2629.sp
rgallardb6435452013-11-25 20:19:02 -08002630The following example shows how to set the size of the subdivisions to 16 MB:
rgallard36ba8532014-06-06 15:45:48 -07002631.sp
2632.if n \{\
2633.RS 4
2634.\}
2635.nf
2636\fB\-XX:G1HeapRegionSize=16m\fR
2637
2638.fi
2639.if n \{\
2640.RE
2641.\}
2642.RE
2643.PP
2644\-XX:+G1PrintHeapRegions
2645.RS 4
rgallardb6435452013-11-25 20:19:02 -08002646Enables the printing of information about which regions are allocated and which are reclaimed by the G1 collector\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002647.RE
2648.PP
2649\-XX:G1ReservePercent=\fIpercent\fR
2650.RS 4
rgallardb6435452013-11-25 20:19:02 -08002651Sets the percentage of the heap (0 to 50) that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector\&. By default, this option is set to 10%\&.
rgallard36ba8532014-06-06 15:45:48 -07002652.sp
rgallardb6435452013-11-25 20:19:02 -08002653The following example shows how to set the reserved heap to 20%:
rgallard36ba8532014-06-06 15:45:48 -07002654.sp
2655.if n \{\
2656.RS 4
2657.\}
2658.nf
2659\fB\-XX:G1ReservePercent=20\fR
2660
2661.fi
2662.if n \{\
2663.RE
2664.\}
2665.RE
2666.PP
2667\-XX:InitialHeapSize=\fIsize\fR
2668.RS 4
2669Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter
2670\fBk\fR
2671or
2672\fBK\fR
2673to indicate kilobytes,
2674\fBm\fR
2675or
2676\fBM\fR
2677to indicate megabytes,
2678\fBg\fR
2679or
2680\fBG\fR
2681to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
2682.sp
rgallardb6435452013-11-25 20:19:02 -08002683The following examples show how to set the size of allocated memory to 6 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -07002684.sp
2685.if n \{\
2686.RS 4
2687.\}
2688.nf
2689\fB\-XX:InitialHeapSize=6291456\fR
2690\fB\-XX:InitialHeapSize=6144k\fR
2691\fB\-XX:InitialHeapSize=6m\fR
2692
2693.fi
2694.if n \{\
2695.RE
2696.\}
2697If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the
2698\fB\-XX:NewSize\fR
2699option\&.
2700.RE
2701.PP
2702\-XX:InitialSurvivorRatio=\fIratio\fR
2703.RS 4
2704Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the
2705\fB\-XX:+UseParallelGC\fR
2706and/or \-\fBXX:+UseParallelOldGC\fR
2707options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the
2708\fB\-XX:+UseParallelGC\fR
2709and
2710\fB\-XX:+UseParallelOldGC\fR
2711options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the
2712\fB\-XX:\-UseAdaptiveSizePolicy\fR
2713option), then the
2714\fB\-XX:SurvivorRatio\fR
2715option should be used to set the size of the survivor space for the entire execution of the application\&.
2716.sp
rgallardb6435452013-11-25 20:19:02 -08002717The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R):
rgallard36ba8532014-06-06 15:45:48 -07002718.sp
2719.if n \{\
2720.RS 4
2721.\}
2722.nf
2723\fBS=Y/(R+2)\fR
2724
2725.fi
2726.if n \{\
2727.RE
2728.\}
rgallardb6435452013-11-25 20:19:02 -08002729The 2 in the equation denotes two survivor spaces\&. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size\&.
rgallard36ba8532014-06-06 15:45:48 -07002730.sp
rgallardb6435452013-11-25 20:19:02 -08002731By default, the initial survivor space ratio is set to 8\&. If the default value for the young generation space size is used (2 MB), the initial size of the survivor space will be 0\&.2 MB\&.
rgallard36ba8532014-06-06 15:45:48 -07002732.sp
rgallardb6435452013-11-25 20:19:02 -08002733The following example shows how to set the initial survivor space ratio to 4:
rgallard36ba8532014-06-06 15:45:48 -07002734.sp
2735.if n \{\
2736.RS 4
2737.\}
2738.nf
2739\fB\-XX:InitialSurvivorRatio=4\fR
2740
2741.fi
2742.if n \{\
2743.RE
2744.\}
2745.RE
2746.PP
2747\-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
2748.RS 4
rgallardb6435452013-11-25 20:19:02 -08002749Sets the percentage of the heap occupancy (0 to 100) at which to start a concurrent GC cycle\&. It is used by garbage collectors that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (for example, the G1 garbage collector)\&.
rgallard36ba8532014-06-06 15:45:48 -07002750.sp
rgallardb6435452013-11-25 20:19:02 -08002751By default, the initiating value is set to 45%\&. A value of 0 implies nonstop GC cycles\&. The following example shows how to set the initiating heap occupancy to 75%:
rgallard36ba8532014-06-06 15:45:48 -07002752.sp
2753.if n \{\
2754.RS 4
2755.\}
2756.nf
2757\fB\-XX:InitiatingHeapOccupancyPercent=75\fR
2758
2759.fi
2760.if n \{\
2761.RE
2762.\}
2763.RE
2764.PP
2765\-XX:MaxGCPauseMillis=\fItime\fR
2766.RS 4
rgallardb6435452013-11-25 20:19:02 -08002767Sets a target for the maximum GC pause time (in milliseconds)\&. This is a soft goal, and the JVM will make its best effort to achieve it\&. By default, there is no maximum pause time value\&.
rgallard36ba8532014-06-06 15:45:48 -07002768.sp
rgallardb6435452013-11-25 20:19:02 -08002769The following example shows how to set the maximum target pause time to 500 ms:
rgallard36ba8532014-06-06 15:45:48 -07002770.sp
2771.if n \{\
2772.RS 4
2773.\}
2774.nf
2775\fB\-XX:MaxGCPauseMillis=500\fR
2776
2777.fi
2778.if n \{\
2779.RE
2780.\}
2781.RE
2782.PP
2783\-XX:MaxHeapSize=\fIsize\fR
2784.RS 4
2785Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
2786\fBk\fR
2787or
2788\fBK\fR
2789to indicate kilobytes,
2790\fBm\fR
2791or
2792\fBM\fR
2793to indicate megabytes,
2794\fBg\fR
2795or
2796\fBG\fR
2797to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
2798\fB\-XX:InitialHeapSize\fR
2799and
2800\fB\-XX:MaxHeapSize\fR
2801are often set to the same value\&. For more information, see Garbage Collector Ergonomics at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gc\-ergonomics\&.html
2802.sp
rgallardb6435452013-11-25 20:19:02 -08002803The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -07002804.sp
2805.if n \{\
2806.RS 4
2807.\}
2808.nf
2809\fB\-XX:MaxHeapSize=83886080\fR
2810\fB\-XX:MaxHeapSize=81920k\fR
2811\fB\-XX:MaxHeapSize=80m\fR
2812
2813.fi
2814.if n \{\
2815.RE
2816.\}
rgallardb6435452013-11-25 20:19:02 -08002817On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus overhead amounts\&. On Oracle Solaris 2\&.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&.
rgallard36ba8532014-06-06 15:45:48 -07002818.sp
2819The
2820\fB\-XX:MaxHeapSize\fR
2821option is equivalent to
2822\fB\-Xmx\fR\&.
2823.RE
2824.PP
2825\-XX:MaxHeapFreeRatio=\fIpercent\fR
2826.RS 4
rgallardb6435452013-11-25 20:19:02 -08002827Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space expands above this value, then the heap will be shrunk\&. By default, this value is set to 70%\&.
rgallard36ba8532014-06-06 15:45:48 -07002828.sp
rgallardb6435452013-11-25 20:19:02 -08002829The following example shows how to set the maximum free heap ratio to 75%:
rgallard36ba8532014-06-06 15:45:48 -07002830.sp
2831.if n \{\
2832.RS 4
2833.\}
2834.nf
2835\fB\-XX:MaxHeapFreeRatio=75\fR
2836
2837.fi
2838.if n \{\
2839.RE
2840.\}
2841.RE
2842.PP
2843\-XX:MaxMetaspaceSize=\fIsize\fR
2844.RS 4
rgallardb6435452013-11-25 20:19:02 -08002845Sets the maximum amount of native memory that can be allocated for class metadata\&. By default, the size is not limited\&. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system\&.
rgallard36ba8532014-06-06 15:45:48 -07002846.sp
rgallardb6435452013-11-25 20:19:02 -08002847The following example shows how to set the maximum class metadata size to 256 MB:
rgallard36ba8532014-06-06 15:45:48 -07002848.sp
2849.if n \{\
2850.RS 4
2851.\}
2852.nf
2853\fB\-XX:MaxMetaspaceSize=256m\fR
2854
2855.fi
2856.if n \{\
2857.RE
2858.\}
2859.RE
2860.PP
2861\-XX:MaxNewSize=\fIsize\fR
2862.RS 4
rgallardb6435452013-11-25 20:19:02 -08002863Sets the maximum size (in bytes) of the heap for the young generation (nursery)\&. The default value is set ergonomically\&.
rgallard36ba8532014-06-06 15:45:48 -07002864.RE
2865.PP
2866\-XX:MaxTenuringThreshold=\fIthreshold\fR
2867.RS 4
rgallardb6435452013-11-25 20:19:02 -08002868Sets the maximum tenuring threshold for use in adaptive GC sizing\&. The largest value is 15\&. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector\&.
rgallard36ba8532014-06-06 15:45:48 -07002869.sp
rgallardb6435452013-11-25 20:19:02 -08002870The following example shows how to set the maximum tenuring threshold to 10:
rgallard36ba8532014-06-06 15:45:48 -07002871.sp
2872.if n \{\
2873.RS 4
2874.\}
2875.nf
2876\fB\-XX:MaxTenuringThreshold=10\fR
2877
2878.fi
2879.if n \{\
2880.RE
2881.\}
2882.RE
2883.PP
2884\-XX:MetaspaceSize=\fIsize\fR
2885.RS 4
rgallardb6435452013-11-25 20:19:02 -08002886Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded\&. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used\&. The default size depends on the platform\&.
rgallard36ba8532014-06-06 15:45:48 -07002887.RE
2888.PP
2889\-XX:MinHeapFreeRatio=\fIpercent\fR
2890.RS 4
rgallardb6435452013-11-25 20:19:02 -08002891Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space falls below this value, then the heap will be expanded\&. By default, this value is set to 40%\&.
rgallard36ba8532014-06-06 15:45:48 -07002892.sp
rgallardb6435452013-11-25 20:19:02 -08002893The following example shows how to set the minimum free heap ratio to 25%:
rgallard36ba8532014-06-06 15:45:48 -07002894.sp
2895.if n \{\
2896.RS 4
2897.\}
2898.nf
2899\fB\-XX:MinHeapFreeRatio=25\fR
2900
2901.fi
2902.if n \{\
2903.RE
2904.\}
2905.RE
2906.PP
2907\-XX:NewRatio=\fIratio\fR
2908.RS 4
rgallardb6435452013-11-25 20:19:02 -08002909Sets the ratio between young and old generation sizes\&. By default, this option is set to 2\&. The following example shows how to set the young/old ratio to 1:
rgallard36ba8532014-06-06 15:45:48 -07002910.sp
2911.if n \{\
2912.RS 4
2913.\}
2914.nf
2915\fB\-XX:NewRatio=1\fR
2916
2917.fi
2918.if n \{\
2919.RE
2920.\}
2921.RE
2922.PP
2923\-XX:NewSize=\fIsize\fR
2924.RS 4
2925Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
2926\fBk\fR
2927or
2928\fBK\fR
2929to indicate kilobytes,
2930\fBm\fR
2931or
2932\fBM\fR
2933to indicate megabytes,
2934\fBg\fR
2935or
2936\fBG\fR
2937to indicate gigabytes\&.
2938.sp
rgallardb6435452013-11-25 20:19:02 -08002939The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too low, then a large number of minor GCs will be performed\&. If the size is too high, then only full GCs will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
rgallard36ba8532014-06-06 15:45:48 -07002940.sp
rgallardb6435452013-11-25 20:19:02 -08002941The following examples show how to set the initial size of young generation to 256 MB using various units:
rgallard36ba8532014-06-06 15:45:48 -07002942.sp
2943.if n \{\
2944.RS 4
2945.\}
2946.nf
2947\fB\-XX:NewSize=256m\fR
2948\fB\-XX:NewSize=262144k\fR
2949\fB\-XX:NewSize=268435456\fR
2950
2951.fi
2952.if n \{\
2953.RE
2954.\}
2955The
2956\fB\-XX:NewSize\fR
2957option is equivalent to
2958\fB\-Xmn\fR\&.
2959.RE
2960.PP
2961\-XX:ParallelGCThreads=\fIthreads\fR
2962.RS 4
rgallardb6435452013-11-25 20:19:02 -08002963Sets the number of threads used for parallel garbage collection in the young and old generations\&. The default value depends on the number of CPUs available to the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -07002964.sp
rgallardb6435452013-11-25 20:19:02 -08002965For example, to set the number of threads for parallel GC to 2, specify the following option:
rgallard36ba8532014-06-06 15:45:48 -07002966.sp
2967.if n \{\
2968.RS 4
2969.\}
2970.nf
2971\fB\-XX:ParallelGCThreads=2\fR
2972
2973.fi
2974.if n \{\
2975.RE
2976.\}
2977.RE
2978.PP
2979\-XX:+ParallelRefProcEnabled
2980.RS 4
rgallardb6435452013-11-25 20:19:02 -08002981Enables parallel reference processing\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002982.RE
2983.PP
2984\-XX:+PrintAdaptiveSizePolicy
2985.RS 4
rgallardb6435452013-11-25 20:19:02 -08002986Enables printing of information about adaptive generation sizing\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002987.RE
2988.PP
2989\-XX:+PrintGC
2990.RS 4
rgallardb6435452013-11-25 20:19:02 -08002991Enables printing of messages at every GC\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002992.RE
2993.PP
2994\-XX:+PrintGCApplicationConcurrentTime
2995.RS 4
rgallardb6435452013-11-25 20:19:02 -08002996Enables printing of how much time elapsed since the last pause (for example, a GC pause)\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07002997.RE
2998.PP
2999\-XX:+PrintGCApplicationStoppedTime
3000.RS 4
rgallardb6435452013-11-25 20:19:02 -08003001Enables printing of how much time the pause (for example, a GC pause) lasted\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003002.RE
3003.PP
3004\-XX:+PrintGCDateStamps
3005.RS 4
rgallardb6435452013-11-25 20:19:02 -08003006Enables printing of a date stamp at every GC\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003007.RE
3008.PP
3009\-XX:+PrintGCDetails
3010.RS 4
rgallardb6435452013-11-25 20:19:02 -08003011Enables printing of detailed messages at every GC\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003012.RE
3013.PP
3014\-XX:+PrintGCTaskTimeStamps
3015.RS 4
rgallardb6435452013-11-25 20:19:02 -08003016Enables printing of time stamps for every individual GC worker thread task\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003017.RE
3018.PP
3019\-XX:+PrintGCTimeStamps
3020.RS 4
rgallardb6435452013-11-25 20:19:02 -08003021Enables printing of time stamps at every GC\&. By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003022.RE
3023.PP
3024\-XX:+PrintStringDeduplicationStatistics
3025.RS 4
3026Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the
3027\fB\-XX:+UseStringDeduplication\fR
3028option\&.
3029.RE
3030.PP
3031\-XX:+PrintTenuringDistribution
3032.RS 4
rgallardb6435452013-11-25 20:19:02 -08003033Enables printing of tenuring age information\&. The following is an example of the output:
rgallard36ba8532014-06-06 15:45:48 -07003034.sp
3035.if n \{\
3036.RS 4
3037.\}
3038.nf
3039\fBDesired survivor size 48286924 bytes, new threshold 10 (max 10)\fR
3040\fB\- age 1: 28992024 bytes, 28992024 total\fR
3041\fB\- age 2: 1366864 bytes, 30358888 total\fR
3042\fB\- age 3: 1425912 bytes, 31784800 total\fR
3043\fB\&.\&.\&.\fR
3044
3045.fi
3046.if n \{\
3047.RE
3048.\}
rgallardb6435452013-11-25 20:19:02 -08003049Age 1 objects are the youngest survivors (they were created after the previous scavenge, survived the latest scavenge, and moved from eden to survivor space)\&. Age 2 objects have survived two scavenges (during the second scavenge they were copied from one survivor space to the next)\&. And so on\&.
rgallard36ba8532014-06-06 15:45:48 -07003050.sp
rgallardb6435452013-11-25 20:19:02 -08003051In the preceding example, 28 992 024 bytes survived one scavenge and were copied from eden to survivor space, 1 366 864 bytes are occupied by age 2 objects, etc\&. The third value in each row is the cumulative size of objects of age n or less\&.
rgallard36ba8532014-06-06 15:45:48 -07003052.sp
rgallardb6435452013-11-25 20:19:02 -08003053By default, this option is disabled\&.
rgallard36ba8532014-06-06 15:45:48 -07003054.RE
3055.PP
3056\-XX:+ScavengeBeforeFullGC
3057.RS 4
3058Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you
3059\fIdo not\fR
3060disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify
3061\fB\-XX:\-ScavengeBeforeFullGC\fR\&.
3062.RE
3063.PP
3064\-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
3065.RS 4
3066Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The
3067\fB\-XX:SoftRefLRUPolicyMSPerMB\fR
3068option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the
3069\fB\-Xmx\fR
3070option has a significant effect on how quickly soft references are garbage collected\&.
3071.sp
rgallardb6435452013-11-25 20:19:02 -08003072The following example shows how to set the value to 2\&.5 seconds:
rgallard36ba8532014-06-06 15:45:48 -07003073.sp
3074.if n \{\
3075.RS 4
3076.\}
3077.nf
3078\fB\-XX:SoftRefLRUPolicyMSPerMB=2500\fR
3079
3080.fi
3081.if n \{\
3082.RE
3083.\}
3084.RE
3085.PP
3086\-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
3087.RS 4
3088\fBString\fR
3089objects reaching the specified age are considered candidates for deduplication\&. An object\*(Aqs age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the
3090\fB\-XX:+PrintTenuringDistribution\fR
3091option\&. Note that
3092\fBString\fR
3093objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is
3094\fB3\fR\&. See the
3095\fB\-XX:+UseStringDeduplication\fR
3096option\&.
3097.RE
3098.PP
3099\-XX:SurvivorRatio=\fIratio\fR
3100.RS 4
rgallardb6435452013-11-25 20:19:02 -08003101Sets the ratio between eden space size and survivor space size\&. By default, this option is set to 8\&. The following example shows how to set the eden/survivor space ratio to 4:
rgallard36ba8532014-06-06 15:45:48 -07003102.sp
3103.if n \{\
3104.RS 4
3105.\}
3106.nf
3107\fB\-XX:SurvivorRatio=4\fR
3108
3109.fi
3110.if n \{\
3111.RE
3112.\}
3113.RE
3114.PP
3115\-XX:TargetSurvivorRatio=\fIpercent\fR
3116.RS 4
rgallardb6435452013-11-25 20:19:02 -08003117Sets the desired percentage of survivor space (0 to 100) used after young garbage collection\&. By default, this option is set to 50%\&.
rgallard36ba8532014-06-06 15:45:48 -07003118.sp
rgallardb6435452013-11-25 20:19:02 -08003119The following example shows how to set the target survivor space ratio to 30%:
rgallard36ba8532014-06-06 15:45:48 -07003120.sp
3121.if n \{\
3122.RS 4
3123.\}
3124.nf
3125\fB\-XX:TargetSurvivorRatio=30\fR
3126
3127.fi
3128.if n \{\
3129.RE
3130.\}
3131.RE
3132.PP
3133\-XX:TLABSize=\fIsize\fR
3134.RS 4
3135Sets the initial size (in bytes) of a thread\-local allocation buffer (TLAB)\&. Append the letter
3136\fBk\fR
3137or
3138\fBK\fR
3139to indicate kilobytes,
3140\fBm\fR
3141or
3142\fBM\fR
3143to indicate megabytes,
3144\fBg\fR
3145or
3146\fBG\fR
3147to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
3148.sp
rgallardb6435452013-11-25 20:19:02 -08003149The following example shows how to set the initial TLAB size to 512 KB:
rgallard36ba8532014-06-06 15:45:48 -07003150.sp
3151.if n \{\
3152.RS 4
3153.\}
3154.nf
3155\fB\-XX:TLABSize=512k\fR
3156
3157.fi
3158.if n \{\
3159.RE
3160.\}
3161.RE
3162.PP
3163\-XX:+UseAdaptiveSizePolicy
3164.RS 4
3165Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify
3166\fB\-XX:\-UseAdaptiveSizePolicy\fR
3167and set the size of the memory allocation pool explicitly (see the
3168\fB\-XX:SurvivorRatio\fR
3169option)\&.
3170.RE
3171.PP
3172\-XX:+UseCMSInitiatingOccupancyOnly
3173.RS 4
rgallardb6435452013-11-25 20:19:02 -08003174Enables the use of the occupancy value as the only criterion for initiating the CMS collector\&. By default, this option is disabled and other criteria may be used\&.
rgallard36ba8532014-06-06 15:45:48 -07003175.RE
3176.PP
3177\-XX:+UseConcMarkSweepGC
3178.RS 4
3179Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\fB\-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\fB\-XX:+UseG1GC\fR) is another alternative\&.
3180.sp
3181By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the
3182\fB\-XX:+UseParNewGC\fR
3183option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8:
3184\fB\-XX:+UseConcMarkSweepGC \-XX:\-UseParNewGC\fR\&.
3185.RE
3186.PP
3187\-XX:+UseG1GC
3188.RS 4
3189Enables the use of the garbage\-first (G1) garbage collector\&. It is a server\-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
3190.sp
rgallardb6435452013-11-25 20:19:02 -08003191By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -07003192.RE
3193.PP
3194\-XX:+UseGCOverheadLimit
3195.RS 4
3196Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an
3197\fBOutOfMemoryError\fR
3198exception is thrown\&. This option is enabled, by default and the parallel GC will throw an
3199\fBOutOfMemoryError\fR
3200if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify
3201\fB\-XX:\-UseGCOverheadLimit\fR\&.
3202.RE
3203.PP
3204\-XX:+UseNUMA
3205.RS 4
3206Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\*(Aqs use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\fB\-XX:+UseParallelGC\fR)\&.
3207.RE
3208.PP
3209\-XX:+UseParallelGC
3210.RS 4
rgallardb6435452013-11-25 20:19:02 -08003211Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors\&.
rgallard36ba8532014-06-06 15:45:48 -07003212.sp
3213By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the
3214\fB\-XX:+UseParallelOldGC\fR
3215option is automatically enabled, unless you explicitly disable it\&.
3216.RE
3217.PP
3218\-XX:+UseParallelOldGC
3219.RS 4
3220Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the
3221\fB\-XX:+UseParallelGC\fR
3222option\&.
3223.RE
3224.PP
3225\-XX:+UseParNewGC
3226.RS 4
3227Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the
3228\fB\-XX:+UseConcMarkSweepGC\fR
3229option\&. Using the
3230\fB\-XX:+UseParNewGC\fR
3231option without the
3232\fB\-XX:+UseConcMarkSweepGC\fR
3233option was deprecated in JDK 8\&.
3234.RE
3235.PP
3236\-XX:+UseSerialGC
3237.RS 4
rgallardb6435452013-11-25 20:19:02 -08003238Enables the use of the serial garbage collector\&. This is generally the best choice for small and simple applications that do not require any special functionality from garbage collection\&. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
rgallard36ba8532014-06-06 15:45:48 -07003239.RE
3240.PP
3241\-XX:+UseStringDeduplication
3242.RS 4
3243Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage\-first (G1) garbage collector\&. See the
3244\fB\-XX:+UseG1GC\fR
3245option\&.
3246.sp
3247\fIString deduplication\fR
3248reduces the memory footprint of
3249\fBString\fR
3250objects on the Java heap by taking advantage of the fact that many
3251\fBString\fR
3252objects are identical\&. Instead of each
3253\fBString\fR
3254object pointing to its own character array, identical
3255\fBString\fR
3256objects can point to and share the same character array\&.
3257.RE
3258.PP
3259\-XX:+UseTLAB
3260.RS 4
3261Enables the use of thread\-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify
3262\fB\-XX:\-UseTLAB\fR\&.
3263.RE
3264.SS "Deprecated and Removed Options"
3265.PP
rgallardb6435452013-11-25 20:19:02 -08003266These options were included in the previous release, but have since been considered unnecessary\&.
rgallard36ba8532014-06-06 15:45:48 -07003267.PP
3268\-Xincgc
3269.RS 4
rgallard1cc205c2014-01-09 16:10:24 -08003270Enables incremental garbage collection\&. This option was deprecated in JDK 8 with no replacement\&.
rgallard36ba8532014-06-06 15:45:48 -07003271.RE
3272.PP
3273\-Xrun\fIlibname\fR
3274.RS 4
3275Loads the specified debugging/profiling library\&. This option was superseded by the
3276\fB\-agentlib\fR
3277option\&.
3278.RE
3279.PP
3280\-XX:CMSIncrementalDutyCycle=\fIpercent\fR
3281.RS 4
3282Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3283\fB\-XX:+CMSIncrementalMode\fR
3284option\&.
3285.RE
3286.PP
3287\-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
3288.RS 4
3289Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when
3290\fB\-XX:+CMSIncrementalPacing\fR
3291is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3292\fB\-XX:+CMSIncrementalMode\fR
3293option\&.
3294.RE
3295.PP
3296\-XX:+CMSIncrementalMode
3297.RS 4
3298Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with
3299\fBCMSIncremental\fR\&.
3300.RE
3301.PP
3302\-XX:CMSIncrementalOffset=\fIpercent\fR
3303.RS 4
3304Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3305\fB\-XX:+CMSIncrementalMode\fR
3306option\&.
3307.RE
3308.PP
3309\-XX:+CMSIncrementalPacing
3310.RS 4
3311Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3312\fB\-XX:+CMSIncrementalMode\fR
3313option\&.
3314.RE
3315.PP
3316\-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
3317.RS 4
3318Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3319\fB\-XX:+CMSIncrementalMode\fR
3320option\&.
3321.RE
3322.PP
3323\-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
3324.RS 4
rgallardb6435452013-11-25 20:19:02 -08003325Sets the percentage of the permanent generation occupancy (0 to 100) at which to start a GC\&. This option was deprecated in JDK 8 with no replacement\&.
rgallard36ba8532014-06-06 15:45:48 -07003326.RE
3327.PP
3328\-XX:MaxPermSize=\fIsize\fR
3329.RS 4
3330Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the
3331\fB\-XX:MaxMetaspaceSize\fR
3332option\&.
3333.RE
3334.PP
3335\-XX:PermSize=\fIsize\fR
3336.RS 4
3337Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the
3338\fB\-XX:MetaspaceSize\fR
3339option\&.
3340.RE
3341.PP
3342\-XX:+UseSplitVerifier
3343.RS 4
rgallardb6435452013-11-25 20:19:02 -08003344Enables splitting of the verification process\&. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime)\&. This option was deprecated in JDK 8, and verification is now split by default without a way to disable it\&.
rgallard36ba8532014-06-06 15:45:48 -07003345.RE
3346.PP
3347\-XX:+UseStringCache
3348.RS 4
rgallardb6435452013-11-25 20:19:02 -08003349Enables caching of commonly allocated strings\&. This option was removed from JDK 8 with no replacement\&.
rgallard36ba8532014-06-06 15:45:48 -07003350.RE
3351.SH "PERFORMANCE TUNING EXAMPLES"
3352.PP
rgallardb6435452013-11-25 20:19:02 -08003353The following examples show how to use experimental tuning flags to either optimize throughput or to provide lower response time\&.
3354.PP
rgallard36ba8532014-06-06 15:45:48 -07003355\fBExample 1\fR
3356.br
3357Tuning for Higher Throughput
3358.RS 4
3359.sp
3360.if n \{\
3361.RS 4
3362.\}
3363.nf
3364\fBjava \-d64 \-server \-XX:+AggressiveOpts \-XX:+UseLargePages \-Xmn10g \-Xms26g \-Xmx26g\fR
3365
3366.fi
3367.if n \{\
3368.RE
3369.\}
3370.RE
3371.PP
3372\fBExample 2\fR
3373.br
3374Tuning for Lower Response Time
3375.RS 4
3376.sp
3377.if n \{\
3378.RS 4
3379.\}
3380.nf
3381\fBjava \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fR
3382
3383.fi
3384.if n \{\
3385.RE
3386.\}
3387.RE
3388.SH "EXIT STATUS"
3389.PP
3390The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call
3391\fBSystem\&.exit(exitValue)\fR\&. The values are:
3392.sp
3393.RS 4
3394.ie n \{\
3395\h'-04'\(bu\h'+03'\c
3396.\}
3397.el \{\
3398.sp -1
3399.IP \(bu 2.3
3400.\}
3401\fB0\fR: Successful completion
3402.RE
3403.sp
3404.RS 4
3405.ie n \{\
3406\h'-04'\(bu\h'+03'\c
3407.\}
3408.el \{\
3409.sp -1
3410.IP \(bu 2.3
3411.\}
3412\fB>0\fR: An error occurred
3413.RE
3414.SH "SEE ALSO"
3415.sp
3416.RS 4
3417.ie n \{\
3418\h'-04'\(bu\h'+03'\c
3419.\}
3420.el \{\
3421.sp -1
3422.IP \(bu 2.3
3423.\}
rgallardb6435452013-11-25 20:19:02 -08003424javac(1)
rgallard36ba8532014-06-06 15:45:48 -07003425.RE
3426.sp
3427.RS 4
3428.ie n \{\
3429\h'-04'\(bu\h'+03'\c
3430.\}
3431.el \{\
3432.sp -1
3433.IP \(bu 2.3
3434.\}
rgallardb6435452013-11-25 20:19:02 -08003435jdb(1)
rgallard36ba8532014-06-06 15:45:48 -07003436.RE
3437.sp
3438.RS 4
3439.ie n \{\
3440\h'-04'\(bu\h'+03'\c
3441.\}
3442.el \{\
3443.sp -1
3444.IP \(bu 2.3
3445.\}
rgallardb6435452013-11-25 20:19:02 -08003446javah(1)
rgallard36ba8532014-06-06 15:45:48 -07003447.RE
3448.sp
3449.RS 4
3450.ie n \{\
3451\h'-04'\(bu\h'+03'\c
3452.\}
3453.el \{\
3454.sp -1
3455.IP \(bu 2.3
3456.\}
rgallardb6435452013-11-25 20:19:02 -08003457jar(1)
rgallard36ba8532014-06-06 15:45:48 -07003458.RE
3459.br
3460'pl 8.5i
3461'bp