1java(1) Basic Tools java(1)
2
3
4
6 java - Launches a Java application.
7
9 java [options] classname [args]
10
11 java [options] -jar filename [args]
12
13 options
14 Command-line options separated by spaces. See Options.
15
16 classname
17 The name of the class to be launched.
18
19 filename
20 The name of the Java Archive (JAR) file to be called. Used only
21 with the -jar option.
22
23 args
24 The arguments passed to the main() method separated by spaces.
25
27 The java command starts a Java application. It does this by starting
28 the Java Runtime Environment (JRE), loading the specified class, and
29 calling that class's main() method. The method must be declared public
30 and static, it must not return any value, and it must accept a String
31 array as a parameter. The method declaration has the following form:
32
33 public static void main(String[] args)
34
35
36 The java command can be used to launch a JavaFX application by loading
37 a class that either has a main() method or that extends
38 javafx.application.Application. In the latter case, the launcher
39 constructs an instance of the Application class, calls its init()
40 method, and then calls the start(javafx.stage.Stage) method.
41
42 By default, the first argument that is not an option of the java
43 command is the fully qualified name of the class to be called. If the
44 -jar option is specified, its argument is the name of the JAR file
45 containing class and resource files for the application. The startup
46 class must be indicated by the Main-Class manifest header in its source
47 code.
48
49 The JRE searches for the startup class (and other classes used by the
50 application) in three sets of locations: the bootstrap class path, the
51 installed extensions, and the user’s class path.
52
53 Arguments after the class file name or the JAR file name are passed to
54 the main() method.
55
57 The java command supports a wide range of options that can be divided
58 into the following categories:
59
60 · Standard Options
61
62 · Non-Standard Options
63
64 · Advanced Runtime Options
65
66 · Advanced JIT Compiler Options
67
68 · Advanced Serviceability Options
69
70 · Advanced Garbage Collection Options
71
72 Standard options are guaranteed to be supported by all implementations
73 of the Java Virtual Machine (JVM). They are used for common actions,
74 such as checking the version of the JRE, setting the class path,
75 enabling verbose output, and so on.
76
77 Non-standard options are general purpose options that are specific to
78 the Java HotSpot Virtual Machine, so they are not guaranteed to be
79 supported by all JVM implementations, and are subject to change. These
80 options start with -X.
81
82 Advanced options are not recommended for casual use. These are
83 developer options used for tuning specific areas of the Java HotSpot
84 Virtual Machine operation that often have specific system requirements
85 and may require privileged access to system configuration parameters.
86 They are also not guaranteed to be supported by all JVM
87 implementations, and are subject to change. Advanced options start with
88 -XX.
89
90 To keep track of the options that were deprecated or removed in the
91 latest release, there is a section named Deprecated and Removed Options
92 at the end of the document.
93
94 Boolean options are used to either enable a feature that is disabled by
95 default or disable a feature that is enabled by default. Such options
96 do not require a parameter. Boolean -XX options are enabled using the
97 plus sign (-XX:+OptionName) and disabled using the minus sign
98 (-XX:-OptionName).
99
100 For options that require an argument, the argument may be separated
101 from the option name by a space, a colon (:), or an equal sign (=), or
102 the argument may directly follow the option (the exact syntax differs
103 for each option). If you are expected to specify the size in bytes, you
104 can use no suffix, or use the suffix k or K for kilobytes (KB), m or M
105 for megabytes (MB), g or G for gigabytes (GB). For example, to set the
106 size to 8 GB, you can specify either 8g, 8192m, 8388608k, or 8589934592
107 as the argument. If you are expected to specify the percentage, use a
108 number from 0 to 1 (for example, specify 0.25 for 25%).
109
110 Standard Options
111 These are the most commonly used options that are supported by all
112 implementations of the JVM.
113
114 -agentlib:libname[=options]
115 Loads the specified native agent library. After the library name, a
116 comma-separated list of options specific to the library can be
117 used.
118
119 If the option -agentlib:foo is specified, then the JVM attempts to
120 load the library named libfoo.so in the location specified by the
121 LD_LIBRARY_PATH system variable (on OS X this variable is
122 DYLD_LIBRARY_PATH).
123
124 The following example shows how to load the heap profiling tool
125 (HPROF) library and get sample CPU information every 20 ms, with a
126 stack depth of 3:
127
128 -agentlib:hprof=cpu=samples,interval=20,depth=3
129
130 The following example shows how to load the Java Debug Wire
131 Protocol (JDWP) library and listen for the socket connection on
132 port 8000, suspending the JVM before the main class loads:
133
134 -agentlib:jdwp=transport=dt_socket,server=y,address=8000
135
136 For more information about the native agent libraries, refer to the
137 following:
138
139 · The java.lang.instrument package description at
140 http://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
141
142 · Agent Command Line Options in the JVM Tools Interface guide at
143 http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#starting
144
145 -agentpath:pathname[=options]
146 Loads the native agent library specified by the absolute path name.
147 This option is equivalent to -agentlib but uses the full path and
148 file name of the library.
149
150 -client
151 Selects the Java HotSpot Client VM. The 64-bit version of the Java
152 SE Development Kit (JDK) currently ignores this option and instead
153 uses the Server JVM.
154
155 For default JVM selection, see Server-Class Machine Detection at
156 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html
157
158 -Dproperty=value
159 Sets a system property value. The property variable is a string
160 with no spaces that represents the name of the property. The value
161 variable is a string that represents the value of the property. If
162 value is a string with spaces, then enclose it in quotation marks
163 (for example -Dfoo="foo bar").
164
165 -d32
166 Runs the application in a 32-bit environment. If a 32-bit
167 environment is not installed or is not supported, then an error
168 will be reported. By default, the application is run in a 32-bit
169 environment unless a 64-bit system is used.
170
171 -d64
172 Runs the application in a 64-bit environment. If a 64-bit
173 environment is not installed or is not supported, then an error
174 will be reported. By default, the application is run in a 32-bit
175 environment unless a 64-bit system is used.
176
177 Currently only the Java HotSpot Server VM supports 64-bit
178 operation, and the -server option is implicit with the use of -d64.
179 The -client option is ignored with the use of -d64. This is subject
180 to change in a future release.
181
182 -disableassertions[:[packagename]...|:classname]
183 -da[:[packagename]...|:classname]
184 Disables assertions. By default, assertions are disabled in all
185 packages and classes.
186
187 With no arguments, -disableassertions (-da) disables assertions in
188 all packages and classes. With the packagename argument ending in
189 ..., the switch disables assertions in the specified package and
190 any subpackages. If the argument is simply ..., then the switch
191 disables assertions in the unnamed package in the current working
192 directory. With the classname argument, the switch disables
193 assertions in the specified class.
194
195 The -disableassertions (-da) option applies to all class loaders
196 and to system classes (which do not have a class loader). There is
197 one exception to this rule: if the option is provided with no
198 arguments, then it does not apply to system classes. This makes it
199 easy to disable assertions in all classes except for system
200 classes. The -disablesystemassertions option enables you to disable
201 assertions in all system classes.
202
203 To explicitly enable assertions in specific packages or classes,
204 use the -enableassertions (-ea) option. Both options can be used at
205 the same time. For example, to run the MyClass application with
206 assertions enabled in package com.wombat.fruitbat (and any
207 subpackages) but disabled in class com.wombat.fruitbat.Brickbat,
208 use the following command:
209
210 java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass
211
212
213 -disablesystemassertions
214 -dsa
215 Disables assertions in all system classes.
216
217 -enableassertions[:[packagename]...|:classname]
218 -ea[:[packagename]...|:classname]
219 Enables assertions. By default, assertions are disabled in all
220 packages and classes.
221
222 With no arguments, -enableassertions (-ea) enables assertions in
223 all packages and classes. With the packagename argument ending in
224 ..., the switch enables assertions in the specified package and any
225 subpackages. If the argument is simply ..., then the switch enables
226 assertions in the unnamed package in the current working directory.
227 With the classname argument, the switch enables assertions in the
228 specified class.
229
230 The -enableassertions (-ea) option applies to all class loaders and
231 to system classes (which do not have a class loader). There is one
232 exception to this rule: if the option is provided with no
233 arguments, then it does not apply to system classes. This makes it
234 easy to enable assertions in all classes except for system classes.
235 The -enablesystemassertions option provides a separate switch to
236 enable assertions in all system classes.
237
238 To explicitly disable assertions in specific packages or classes,
239 use the -disableassertions (-da) option. If a single command
240 contains multiple instances of these switches, then they are
241 processed in order before loading any classes. For example, to run
242 the MyClass application with assertions enabled only in package
243 com.wombat.fruitbat (and any subpackages) but disabled in class
244 com.wombat.fruitbat.Brickbat, use the following command:
245
246 java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass
247
248
249 -enablesystemassertions
250 -esa
251 Enables assertions in all system classes.
252
253 -help
254 -?
255 Displays usage information for the java command without actually
256 running the JVM.
257
258 -jar filename
259 Executes a program encapsulated in a JAR file. The filename
260 argument is the name of a JAR file with a manifest that contains a
261 line in the form Main-Class:classname that defines the class with
262 the public static void main(String[] args) method that serves as
263 your application's starting point.
264
265 When you use the -jar option, the specified JAR file is the source
266 of all user classes, and other class path settings are ignored.
267
268 For more information about JAR files, see the following resources:
269
270 · jar(1)
271
272 · The Java Archive (JAR) Files guide at
273 http://docs.oracle.com/javase/8/docs/technotes/guides/jar/index.html
274
275 · Lesson: Packaging Programs in JAR Files at
276
277 http://docs.oracle.com/javase/tutorial/deployment/jar/index.html
278
279 -javaagent:jarpath[=options]
280 Loads the specified Java programming language agent. For more
281 information about instrumenting Java applications, see the
282 java.lang.instrument package description in the Java API
283 documentation at
284 http://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
285
286 -jre-restrict-search
287 Includes user-private JREs in the version search.
288
289 -no-jre-restrict-search
290 Excludes user-private JREs from the version search.
291
292 -server
293 Selects the Java HotSpot Server VM. The 64-bit version of the JDK
294 supports only the Server VM, so in that case the option is
295 implicit.
296
297 For default JVM selection, see Server-Class Machine Detection at
298 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html
299
300 -showversion
301 Displays version information and continues execution of the
302 application. This option is equivalent to the -version option
303 except that the latter instructs the JVM to exit after displaying
304 version information.
305
306 -splash:imgname
307 Shows the splash screen with the image specified by imgname. For
308 example, to show the splash.gif file from the images directory when
309 starting your application, use the following option:
310
311 -splash:images/splash.gif
312
313
314 -verbose:class
315 Displays information about each loaded class.
316
317 -verbose:gc
318 Displays information about each garbage collection (GC) event.
319
320 -verbose:jni
321 Displays information about the use of native methods and other Java
322 Native Interface (JNI) activity.
323
324 -version
325 Displays version information and then exits. This option is
326 equivalent to the -showversion option except that the latter does
327 not instruct the JVM to exit after displaying version information.
328
329 -version:release
330 Specifies the release version to be used for running the
331 application. If the version of the java command called does not
332 meet this specification and an appropriate implementation is found
333 on the system, then the appropriate implementation will be used.
334
335 The release argument specifies either the exact version string, or
336 a list of version strings and ranges separated by spaces. A version
337 string is the developer designation of the version number in the
338 following form: 1.x.0_u (where x is the major version number, and u
339 is the update version number). A version range is made up of a
340 version string followed by a plus sign (+) to designate this
341 version or later, or a part of a version string followed by an
342 asterisk (*) to designate any version string with a matching
343 prefix. Version strings and ranges can be combined using a space
344 for a logical OR combination, or an ampersand (&) for a logical AND
345 combination of two version strings/ranges. For example, if running
346 the class or JAR file requires either JRE 6u13 (1.6.0_13), or any
347 JRE 6 starting from 6u10 (1.6.0_10), specify the following:
348
349 -version:"1.6.0_13 1.6* & 1.6.0_10+"
350
351 Quotation marks are necessary only if there are spaces in the
352 release parameter.
353
354 For JAR files, the preference is to specify version requirements in
355 the JAR file manifest rather than on the command line.
356
357 Non-Standard Options
358 These options are general purpose options that are specific to the Java
359 HotSpot Virtual Machine.
360
361 -X
362 Displays help for all available -X options.
363
364 -Xbatch
365 Disables background compilation. By default, the JVM compiles the
366 method as a background task, running the method in interpreter mode
367 until the background compilation is finished. The -Xbatch flag
368 disables background compilation so that compilation of all methods
369 proceeds as a foreground task until completed.
370
371 This option is equivalent to -XX:-BackgroundCompilation.
372
373 -Xbootclasspath:path
374 Specifies a list of directories, JAR files, and ZIP archives
375 separated by colons (:) to search for boot class files. These are
376 used in place of the boot class files included in the JDK.
377
378 Do not deploy applications that use this option to override a class
379 in rt.jar, because this violates the JRE binary code license.
380
381 -Xbootclasspath/a:path
382 Specifies a list of directories, JAR files, and ZIP archives
383 separated by colons (:) to append to the end of the default
384 bootstrap class path.
385
386 Do not deploy applications that use this option to override a class
387 in rt.jar, because this violates the JRE binary code license.
388
389 -Xbootclasspath/p:path
390 Specifies a list of directories, JAR files, and ZIP archives
391 separated by colons (:) to prepend to the front of the default
392 bootstrap class path.
393
394 Do not deploy applications that use this option to override a class
395 in rt.jar, because this violates the JRE binary code license.
396
397 -Xcheck:jni
398 Performs additional checks for Java Native Interface (JNI)
399 functions. Specifically, it validates the parameters passed to the
400 JNI function and the runtime environment data before processing the
401 JNI request. Any invalid data encountered indicates a problem in
402 the native code, and the JVM will terminate with an irrecoverable
403 error in such cases. Expect a performance degradation when this
404 option is used.
405
406 -Xcomp
407 Forces compilation of methods on first invocation. By default, the
408 Client VM (-client) performs 1,000 interpreted method invocations
409 and the Server VM (-server) performs 10,000 interpreted method
410 invocations to gather information for efficient compilation.
411 Specifying the -Xcomp option disables interpreted method
412 invocations to increase compilation performance at the expense of
413 efficiency.
414
415 You can also change the number of interpreted method invocations
416 before compilation using the -XX:CompileThreshold option.
417
418 -Xdebug
419 Does nothing. Provided for backward compatibility.
420
421 -Xdiag
422 Shows additional diagnostic messages.
423
424 -Xfuture
425 Enables strict class-file format checks that enforce close
426 conformance to the class-file format specification. Developers are
427 encouraged to use this flag when developing new code because the
428 stricter checks will become the default in future releases.
429
430 -Xint
431 Runs the application in interpreted-only mode. Compilation to
432 native code is disabled, and all bytecode is executed by the
433 interpreter. The performance benefits offered by the just in time
434 (JIT) compiler are not present in this mode.
435
436 -Xinternalversion
437 Displays more detailed JVM version information than the -version
438 option, and then exits.
439
440 -Xloggc:filename
441 Sets the file to which verbose GC events information should be
442 redirected for logging. The information written to this file is
443 similar to the output of -verbose:gc with the time elapsed since
444 the first GC event preceding each logged event. The -Xloggc option
445 overrides -verbose:gc if both are given with the same java command.
446
447 Example:
448
449 -Xloggc:garbage-collection.log
450
451
452 -Xmaxjitcodesize=size
453 Specifies the maximum code cache size (in bytes) for JIT-compiled
454 code. Append the letter k or K to indicate kilobytes, m or M to
455 indicate megabytes, g or G to indicate gigabytes. The default
456 maximum code cache size is 240 MB; if you disable tiered
457 compilation with the option -XX:-TieredCompilation, then the
458 default size is 48 MB:
459
460 -Xmaxjitcodesize=240m
461
462 This option is equivalent to -XX:ReservedCodeCacheSize.
463
464 -Xmixed
465 Executes all bytecode by the interpreter except for hot methods,
466 which are compiled to native code.
467
468 -Xmnsize
469 Sets the initial and maximum size (in bytes) of the heap for the
470 young generation (nursery). Append the letter k or K to indicate
471 kilobytes, m or M to indicate megabytes, g or G to indicate
472 gigabytes.
473
474 The young generation region of the heap is used for new objects. GC
475 is performed in this region more often than in other regions. If
476 the size for the young generation is too small, then a lot of minor
477 garbage collections will be performed. If the size is too large,
478 then only full garbage collections will be performed, which can
479 take a long time to complete. Oracle recommends that you keep the
480 size for the young generation between a half and a quarter of the
481 overall heap size.
482
483 The following examples show how to set the initial and maximum size
484 of young generation to 256 MB using various units:
485
486 -Xmn256m
487 -Xmn262144k
488 -Xmn268435456
489
490 Instead of the -Xmn option to set both the initial and maximum size
491 of the heap for the young generation, you can use -XX:NewSize to
492 set the initial size and -XX:MaxNewSize to set the maximum size.
493
494 -Xmssize
495 Sets the initial size (in bytes) of the heap. This value must be a
496 multiple of 1024 and greater than 1 MB. Append the letter k or K to
497 indicate kilobytes, m or M to indicate megabytes, g or G to
498 indicate gigabytes.
499
500 The following examples show how to set the size of allocated memory
501 to 6 MB using various units:
502
503 -Xms6291456
504 -Xms6144k
505 -Xms6m
506
507 If you do not set this option, then the initial size will be set as
508 the sum of the sizes allocated for the old generation and the young
509 generation. The initial size of the heap for the young generation
510 can be set using the -Xmn option or the -XX:NewSize option.
511
512 -Xmxsize
513 Specifies the maximum size (in bytes) of the memory allocation pool
514 in bytes. This value must be a multiple of 1024 and greater than 2
515 MB. Append the letter k or K to indicate kilobytes, m or M to
516 indicate megabytes, g or G to indicate gigabytes. The default value
517 is chosen at runtime based on system configuration. For server
518 deployments, -Xms and -Xmx are often set to the same value. See the
519 section "Ergonomics" in Java SE HotSpot Virtual Machine Garbage
520 Collection Tuning Guide at
521 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.
522
523 The following examples show how to set the maximum allowed size of
524 allocated memory to 80 MB using various units:
525
526 -Xmx83886080
527 -Xmx81920k
528 -Xmx80m
529
530 The -Xmx option is equivalent to -XX:MaxHeapSize.
531
532 -Xnoclassgc
533 Disables garbage collection (GC) of classes. This can save some GC
534 time, which shortens interruptions during the application run.
535
536 When you specify -Xnoclassgc at startup, the class objects in the
537 application will be left untouched during GC and will always be
538 considered live. This can result in more memory being permanently
539 occupied which, if not used carefully, will throw an out of memory
540 exception.
541
542 -Xrs
543 Reduces the use of operating system signals by the JVM.
544
545 Shutdown hooks enable orderly shutdown of a Java application by
546 running user cleanup code (such as closing database connections) at
547 shutdown, even if the JVM terminates abruptly.
548
549 The JVM catches signals to implement shutdown hooks for unexpected
550 termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate
551 the running of shutdown hooks.
552
553 The JVM uses a similar mechanism to implement the feature of
554 dumping thread stacks for debugging purposes. The JVM uses SIGQUIT
555 to perform thread dumps.
556
557 Applications embedding the JVM frequently need to trap signals such
558 as SIGINT or SIGTERM, which can lead to interference with the JVM
559 signal handlers. The -Xrs option is available to address this
560 issue. When -Xrs is used, the signal masks for SIGINT, SIGTERM,
561 SIGHUP, and SIGQUIT are not changed by the JVM, and signal handlers
562 for these signals are not installed.
563
564 There are two consequences of specifying -Xrs:
565
566 · SIGQUIT thread dumps are not available.
567
568 · User code is responsible for causing shutdown hooks to run, for
569 example, by calling System.exit() when the JVM is to be
570 terminated.
571
572 -Xshare:mode
573 Sets the class data sharing (CDS) mode. Possible mode arguments for
574 this option include the following:
575
576 auto
577 Use CDS if possible. This is the default value for Java HotSpot
578 32-Bit Client VM.
579
580 on
581 Require the use of CDS. Print an error message and exit if
582 class data sharing cannot be used.
583
584 off
585 Do not use CDS. This is the default value for Java HotSpot
586 32-Bit Server VM, Java HotSpot 64-Bit Client VM, and Java
587 HotSpot 64-Bit Server VM.
588
589 dump
590 Manually generate the CDS archive. Specify the application
591 class path as described in "Setting the Class Path ".
592
593 You should regenerate the CDS archive with each new JDK
594 release.
595
596 -XshowSettings:category
597 Shows settings and continues. Possible category arguments for this
598 option include the following:
599
600 all
601 Shows all categories of settings. This is the default value.
602
603 locale
604 Shows settings related to locale.
605
606 properties
607 Shows settings related to system properties.
608
609 vm
610 Shows the settings of the JVM.
611
612 -Xsssize
613 Sets the thread stack size (in bytes). Append the letter k or K to
614 indicate KB, m or M to indicate MB, g or G to indicate GB. The
615 default value depends on the platform:
616
617 · Linux/ARM (32-bit): 320 KB
618
619 · Linux/i386 (32-bit): 320 KB
620
621 · Linux/x64 (64-bit): 1024 KB
622
623 · OS X (64-bit): 1024 KB
624
625 · Oracle Solaris/i386 (32-bit): 320 KB
626
627 · Oracle Solaris/x64 (64-bit): 1024 KB
628
629 The following examples set the thread stack size to 1024 KB in
630 different units:
631
632 -Xss1m
633 -Xss1024k
634 -Xss1048576
635
636 This option is equivalent to -XX:ThreadStackSize.
637
638 -Xusealtsigs
639 Use alternative signals instead of SIGUSR1 and SIGUSR2 for JVM
640 internal signals. This option is equivalent to -XX:+UseAltSigs.
641
642 -Xverify:mode
643 Sets the mode of the bytecode verifier. Bytecode verification helps
644 to troubleshoot some problems, but it also adds overhead to the
645 running application. Possible mode arguments for this option
646 include the following:
647
648 none
649 Do not verify the bytecode. This reduces startup time and also
650 reduces the protection provided by Java.
651
652 remote
653 Verify those classes that are not loaded by the bootstrap class
654 loader. This is the default behavior if you do not specify the
655 -Xverify option.
656
657 all
658 Verify all classes.
659
660 Advanced Runtime Options
661 These options control the runtime behavior of the Java HotSpot VM.
662
663 -XX:+DisableAttachMechanism
664 Enables the option that disables the mechanism that lets tools
665 attach to the JVM. By default, this option is disabled, meaning
666 that the attach mechanism is enabled and you can use tools such as
667 jcmd, jstack, jmap, and jinfo.
668
669 -XX:ErrorFile=filename
670 Specifies the path and file name to which error data is written
671 when an irrecoverable error occurs. By default, this file is
672 created in the current working directory and named
673 hs_err_pidpid.log where pid is the identifier of the process that
674 caused the error. The following example shows how to set the
675 default log file (note that the identifier of the process is
676 specified as %p):
677
678 -XX:ErrorFile=./hs_err_pid%p.log
679
680 The following example shows how to set the error log to
681 /var/log/java/java_error.log:
682
683 -XX:ErrorFile=/var/log/java/java_error.log
684
685 If the file cannot be created in the specified directory (due to
686 insufficient space, permission problem, or another issue), then the
687 file is created in the temporary directory for the operating
688 system. The temporary directory is /tmp.
689
690 -XX:+FailOverToOldVerifier
691 Enables automatic failover to the old verifier when the new type
692 checker fails. By default, this option is disabled and it is
693 ignored (that is, treated as disabled) for classes with a recent
694 bytecode version. You can enable it for classes with older versions
695 of the bytecode.
696
697 -XX:LargePageSizeInBytes=size
698 On Solaris, sets the maximum size (in bytes) for large pages used
699 for Java heap. The size argument must be a power of 2 (2, 4, 8, 16,
700 ...). Append the letter k or K to indicate kilobytes, m or M to
701 indicate megabytes, g or G to indicate gigabytes. By default, the
702 size is set to 0, meaning that the JVM chooses the size for large
703 pages automatically.
704
705 The following example illustrates how to set the large page size to
706 4 megabytes (MB):
707
708 -XX:LargePageSizeInBytes=4m
709
710
711 -XX:MaxDirectMemorySize=size
712 Sets the maximum total size (in bytes) of the New I/O (the java.nio
713 package) direct-buffer allocations. Append the letter k or K to
714 indicate kilobytes, m or M to indicate megabytes, g or G to
715 indicate gigabytes. By default, the size is set to 0, meaning that
716 the JVM chooses the size for NIO direct-buffer allocations
717 automatically.
718
719 The following examples illustrate how to set the NIO size to 1024
720 KB in different units:
721
722 -XX:MaxDirectMemorySize=1m
723 -XX:MaxDirectMemorySize=1024k
724 -XX:MaxDirectMemorySize=1048576
725
726
727 -XX:NativeMemoryTracking=mode
728 Specifies the mode for tracking JVM native memory usage. Possible
729 mode arguments for this option include the following:
730
731 off
732 Do not track JVM native memory usage. This is the default
733 behavior if you do not specify the -XX:NativeMemoryTracking
734 option.
735
736 summary
737 Only track memory usage by JVM subsystems, such as Java heap,
738 class, code, and thread.
739
740 detail
741 In addition to tracking memory usage by JVM subsystems, track
742 memory usage by individual CallSite, individual virtual memory
743 region and its committed regions.
744
745 -XX:ObjectAlignmentInBytes=alignment
746 Sets the memory alignment of Java objects (in bytes). By default,
747 the value is set to 8 bytes. The specified value should be a power
748 of two, and must be within the range of 8 and 256 (inclusive). This
749 option makes it possible to use compressed pointers with large Java
750 heap sizes.
751
752 The heap size limit in bytes is calculated as:
753
754 4GB * ObjectAlignmentInBytes
755
756 Note: As the alignment value increases, the unused space between
757 objects will also increase. As a result, you may not realize any
758 benefits from using compressed pointers with large Java heap sizes.
759
760 -XX:OnError=string
761 Sets a custom command or a series of semicolon-separated commands
762 to run when an irrecoverable error occurs. If the string contains
763 spaces, then it must be enclosed in quotation marks.
764
765 The following example shows how the -XX:OnError option can be used
766 to run the gcore command to create the core image, and the debugger
767 is started to attach to the process in case of an irrecoverable
768 error (the %p designates the current process):
769
770 -XX:OnError="gcore %p;dbx - %p"
771
772
773 -XX:OnOutOfMemoryError=string
774 Sets a custom command or a series of semicolon-separated commands
775 to run when an OutOfMemoryError exception is first thrown. If the
776 string contains spaces, then it must be enclosed in quotation
777 marks. For an example of a command string, see the description of
778 the -XX:OnError option.
779
780 -XX:+PerfDataSaveToFile
781 If enabled, saves jstat(1) binary data when the Java application
782 exits. This binary data is saved in a file named hsperfdata_<pid>,
783 where <pid> is the process identifier of the Java application you
784 ran. Use jstat to display the performance data contained in this
785 file as follows:
786
787 jstat -class file:///<path>/hsperfdata_<pid>
788 jstat -gc file:///<path>/hsperfdata_<pid>
789
790 -XX:+PrintCommandLineFlags
791 Enables printing of ergonomically selected JVM flags that appeared
792 on the command line. It can be useful to know the ergonomic values
793 set by the JVM, such as the heap space size and the selected
794 garbage collector. By default, this option is disabled and flags
795 are not printed.
796
797 -XX:+PrintNMTStatistics
798 Enables printing of collected native memory tracking data at JVM
799 exit when native memory tracking is enabled (see
800 -XX:NativeMemoryTracking). By default, this option is disabled and
801 native memory tracking data is not printed.
802
803 -XX:+RelaxAccessControlCheck
804 Decreases the amount of access control checks in the verifier. By
805 default, this option is disabled, and it is ignored (that is,
806 treated as disabled) for classes with a recent bytecode version.
807 You can enable it for classes with older versions of the bytecode.
808
809 -XX:+ShowMessageBoxOnError
810 Enables displaying of a dialog box when the JVM experiences an
811 irrecoverable error. This prevents the JVM from exiting and keeps
812 the process active so that you can attach a debugger to it to
813 investigate the cause of the error. By default, this option is
814 disabled.
815
816 -XX:ThreadStackSize=size
817 Sets the thread stack size (in bytes). Append the letter k or K to
818 indicate kilobytes, m or M to indicate megabytes, g or G to
819 indicate gigabytes. The default value depends on the platform:
820
821 · Linux/ARM (32-bit): 320 KB
822
823 · Linux/i386 (32-bit): 320 KB
824
825 · Linux/x64 (64-bit): 1024 KB
826
827 · OS X (64-bit): 1024 KB
828
829 · Oracle Solaris/i386 (32-bit): 320 KB
830
831 · Oracle Solaris/x64 (64-bit): 1024 KB
832
833 The following examples show how to set the thread stack size to
834 1024 KB in different units:
835
836 -XX:ThreadStackSize=1m
837 -XX:ThreadStackSize=1024k
838 -XX:ThreadStackSize=1048576
839
840 This option is equivalent to -Xss.
841
842 -XX:+TraceClassLoading
843 Enables tracing of classes as they are loaded. By default, this
844 option is disabled and classes are not traced.
845
846 -XX:+TraceClassLoadingPreorder
847 Enables tracing of all loaded classes in the order in which they
848 are referenced. By default, this option is disabled and classes are
849 not traced.
850
851 -XX:+TraceClassResolution
852 Enables tracing of constant pool resolutions. By default, this
853 option is disabled and constant pool resolutions are not traced.
854
855 -XX:+TraceClassUnloading
856 Enables tracing of classes as they are unloaded. By default, this
857 option is disabled and classes are not traced.
858
859 -XX:+TraceLoaderConstraints
860 Enables tracing of the loader constraints recording. By default,
861 this option is disabled and loader constraints recording is not
862 traced.
863
864 -XX:+UseAltSigs
865 Enables the use of alternative signals instead of SIGUSR1 and
866 SIGUSR2 for JVM internal signals. By default, this option is
867 disabled and alternative signals are not used. This option is
868 equivalent to -Xusealtsigs.
869
870 -XX:-UseBiasedLocking
871 Disables the use of biased locking. Some applications with
872 significant amounts of uncontended synchronization may attain
873 significant speedups with this flag enabled, whereas applications
874 with certain patterns of locking may see slowdowns. For more
875 information about the biased locking technique, see the example in
876 Java Tuning White Paper at
877 http://www.oracle.com/technetwork/java/tuning-139912.html#section4.2.5
878
879 By default, this option is enabled.
880
881 -XX:-UseCompressedOops
882 Disables the use of compressed pointers. By default, this option is
883 enabled, and compressed pointers are used when Java heap sizes are
884 less than 32 GB. When this option is enabled, object references are
885 represented as 32-bit offsets instead of 64-bit pointers, which
886 typically increases performance when running the application with
887 Java heap sizes less than 32 GB. This option works only for 64-bit
888 JVMs.
889
890 It is also possible to use compressed pointers when Java heap sizes
891 are greater than 32GB. See the -XX:ObjectAlignmentInBytes option.
892
893 -XX:+UseHugeTLBFS
894 This option for Linux is the equivalent of specifying
895 -XX:+UseLargePages. This option is disabled by default. This option
896 pre-allocates all large pages up-front, when memory is reserved;
897 consequently the JVM cannot dynamically grow or shrink large pages
898 memory areas; see -XX:UseTransparentHugePages if you want this
899 behavior.
900
901 For more information, see "Large Pages".
902
903 -XX:+UseLargePages
904 Enables the use of large page memory. By default, this option is
905 disabled and large page memory is not used.
906
907 For more information, see "Large Pages".
908
909 -XX:+UseMembar
910 Enables issuing of membars on thread state transitions. This option
911 is disabled by default on all platforms except ARM servers, where
912 it is enabled. (It is recommended that you do not disable this
913 option on ARM servers.)
914
915 -XX:+UsePerfData
916 Enables the perfdata feature. This option is enabled by default to
917 allow JVM monitoring and performance testing. Disabling it
918 suppresses the creation of the hsperfdata_userid directories. To
919 disable the perfdata feature, specify -XX:-UsePerfData.
920
921 -XX:+UseTransparentHugePages
922 On Linux, enables the use of large pages that can dynamically grow
923 or shrink. This option is disabled by default. You may encounter
924 performance problems with transparent huge pages as the OS moves
925 other pages around to create huge pages; this option is made
926 available for experimentation.
927
928 For more information, see "Large Pages".
929
930 -XX:+AllowUserSignalHandlers
931 Enables installation of signal handlers by the application. By
932 default, this option is disabled and the application is not allowed
933 to install signal handlers.
934
935 Advanced JIT Compiler Options
936 These options control the dynamic just-in-time (JIT) compilation
937 performed by the Java HotSpot VM.
938
939 -XX:+AggressiveOpts
940 Enables the use of aggressive performance optimization features,
941 which are expected to become default in upcoming releases. By
942 default, this option is disabled and experimental performance
943 features are not used.
944
945 -XX:AllocateInstancePrefetchLines=lines
946 Sets the number of lines to prefetch ahead of the instance
947 allocation pointer. By default, the number of lines to prefetch is
948 set to 1:
949
950 -XX:AllocateInstancePrefetchLines=1
951
952 Only the Java HotSpot Server VM supports this option.
953
954 -XX:AllocatePrefetchDistance=size
955 Sets the size (in bytes) of the prefetch distance for object
956 allocation. Memory about to be written with the value of new
957 objects is prefetched up to this distance starting from the address
958 of the last allocated object. Each Java thread has its own
959 allocation point.
960
961 Negative values denote that prefetch distance is chosen based on
962 the platform. Positive values are bytes to prefetch. Append the
963 letter k or K to indicate kilobytes, m or M to indicate megabytes,
964 g or G to indicate gigabytes. The default value is set to -1.
965
966 The following example shows how to set the prefetch distance to
967 1024 bytes:
968
969 -XX:AllocatePrefetchDistance=1024
970
971 Only the Java HotSpot Server VM supports this option.
972
973 -XX:AllocatePrefetchInstr=instruction
974 Sets the prefetch instruction to prefetch ahead of the allocation
975 pointer. Only the Java HotSpot Server VM supports this option.
976 Possible values are from 0 to 3. The actual instructions behind the
977 values depend on the platform. By default, the prefetch instruction
978 is set to 0:
979
980 -XX:AllocatePrefetchInstr=0
981
982 Only the Java HotSpot Server VM supports this option.
983
984 -XX:AllocatePrefetchLines=lines
985 Sets the number of cache lines to load after the last object
986 allocation by using the prefetch instructions generated in compiled
987 code. The default value is 1 if the last allocated object was an
988 instance, and 3 if it was an array.
989
990 The following example shows how to set the number of loaded cache
991 lines to 5:
992
993 -XX:AllocatePrefetchLines=5
994
995 Only the Java HotSpot Server VM supports this option.
996
997 -XX:AllocatePrefetchStepSize=size
998 Sets the step size (in bytes) for sequential prefetch instructions.
999 Append the letter k or K to indicate kilobytes, m or M to indicate
1000 megabytes, g or G to indicate gigabytes. By default, the step size
1001 is set to 16 bytes:
1002
1003 -XX:AllocatePrefetchStepSize=16
1004
1005 Only the Java HotSpot Server VM supports this option.
1006
1007 -XX:AllocatePrefetchStyle=style
1008 Sets the generated code style for prefetch instructions. The style
1009 argument is an integer from 0 to 3:
1010
1011 0
1012 Do not generate prefetch instructions.
1013
1014 1
1015 Execute prefetch instructions after each allocation. This is
1016 the default parameter.
1017
1018 2
1019 Use the thread-local allocation block (TLAB) watermark pointer
1020 to determine when prefetch instructions are executed.
1021
1022 3
1023 Use BIS instruction on SPARC for allocation prefetch.
1024
1025 Only the Java HotSpot Server VM supports this option.
1026
1027 -XX:+BackgroundCompilation
1028 Enables background compilation. This option is enabled by default.
1029 To disable background compilation, specify
1030 -XX:-BackgroundCompilation (this is equivalent to specifying
1031 -Xbatch).
1032
1033 -XX:CICompilerCount=threads
1034 Sets the number of compiler threads to use for compilation. By
1035 default, the number of threads is set to 2 for the server JVM, to 1
1036 for the client JVM, and it scales to the number of cores if tiered
1037 compilation is used. The following example shows how to set the
1038 number of threads to 2:
1039
1040 -XX:CICompilerCount=2
1041
1042
1043 -XX:CodeCacheMinimumFreeSpace=size
1044 Sets the minimum free space (in bytes) required for compilation.
1045 Append the letter k or K to indicate kilobytes, m or M to indicate
1046 megabytes, g or G to indicate gigabytes. When less than the minimum
1047 free space remains, compiling stops. By default, this option is set
1048 to 500 KB. The following example shows how to set the minimum free
1049 space to 1024 MB:
1050
1051 -XX:CodeCacheMinimumFreeSpace=1024m
1052
1053
1054 -XX:CompileCommand=command,method[,option]
1055 Specifies a command to perform on a method. For example, to exclude
1056 the indexOf() method of the String class from being compiled, use
1057 the following:
1058
1059 -XX:CompileCommand=exclude,java/lang/String.indexOf
1060
1061 Note that the full class name is specified, including all packages
1062 and subpackages separated by a slash (/). For easier cut and paste
1063 operations, it is also possible to use the method name format
1064 produced by the -XX:+PrintCompilation and -XX:+LogCompilation
1065 options:
1066
1067 -XX:CompileCommand=exclude,java.lang.String::indexOf
1068
1069 If the method is specified without the signature, the command will
1070 be applied to all methods with the specified name. However, you can
1071 also specify the signature of the method in the class file format.
1072 In this case, you should enclose the arguments in quotation marks,
1073 because otherwise the shell treats the semicolon as command end.
1074 For example, if you want to exclude only the indexOf(String) method
1075 of the String class from being compiled, use the following:
1076
1077 -XX:CompileCommand="exclude,java/lang/String.indexOf,(Ljava/lang/String;)I"
1078
1079 You can also use the asterisk (*) as a wildcard for class and
1080 method names. For example, to exclude all indexOf() methods in all
1081 classes from being compiled, use the following:
1082
1083 -XX:CompileCommand=exclude,*.indexOf
1084
1085 The commas and periods are aliases for spaces, making it easier to
1086 pass compiler commands through a shell. You can pass arguments to
1087 -XX:CompileCommand using spaces as separators by enclosing the
1088 argument in quotation marks:
1089
1090 -XX:CompileCommand="exclude java/lang/String indexOf"
1091
1092 Note that after parsing the commands passed on the command line
1093 using the -XX:CompileCommand options, the JIT compiler then reads
1094 commands from the .hotspot_compiler file. You can add commands to
1095 this file or specify a different file using the
1096 -XX:CompileCommandFile option.
1097
1098 To add several commands, either specify the -XX:CompileCommand
1099 option multiple times, or separate each argument with the newline
1100 separator (\n). The following commands are available:
1101
1102 break
1103 Set a breakpoint when debugging the JVM to stop at the
1104 beginning of compilation of the specified method.
1105
1106 compileonly
1107 Exclude all methods from compilation except for the specified
1108 method. As an alternative, you can use the -XX:CompileOnly
1109 option, which allows to specify several methods.
1110
1111 dontinline
1112 Prevent inlining of the specified method.
1113
1114 exclude
1115 Exclude the specified method from compilation.
1116
1117 help
1118 Print a help message for the -XX:CompileCommand option.
1119
1120 inline
1121 Attempt to inline the specified method.
1122
1123 log
1124 Exclude compilation logging (with the -XX:+LogCompilation
1125 option) for all methods except for the specified method. By
1126 default, logging is performed for all compiled methods.
1127
1128 option
1129 This command can be used to pass a JIT compilation option to
1130 the specified method in place of the last argument (option).
1131 The compilation option is set at the end, after the method
1132 name. For example, to enable the BlockLayoutByFrequency option
1133 for the append() method of the StringBuffer class, use the
1134 following:
1135
1136 -XX:CompileCommand=option,java/lang/StringBuffer.append,BlockLayoutByFrequency
1137
1138 You can specify multiple compilation options, separated by
1139 commas or spaces.
1140
1141 print
1142 Print generated assembler code after compilation of the
1143 specified method.
1144
1145 quiet
1146 Do not print the compile commands. By default, the commands
1147 that you specify with the -XX:CompileCommand option are
1148 printed; for example, if you exclude from compilation the
1149 indexOf() method of the String class, then the following will
1150 be printed to standard output:
1151
1152 CompilerOracle: exclude java/lang/String.indexOf
1153
1154 You can suppress this by specifying the
1155 -XX:CompileCommand=quiet option before other -XX:CompileCommand
1156 options.
1157
1158 -XX:CompileCommandFile=filename
1159 Sets the file from which JIT compiler commands are read. By
1160 default, the .hotspot_compiler file is used to store commands
1161 performed by the JIT compiler.
1162
1163 Each line in the command file represents a command, a class name,
1164 and a method name for which the command is used. For example, this
1165 line prints assembly code for the toString() method of the String
1166 class:
1167
1168 print java/lang/String toString
1169
1170 For more information about specifying the commands for the JIT
1171 compiler to perform on methods, see the -XX:CompileCommand option.
1172
1173 -XX:CompileOnly=methods
1174 Sets the list of methods (separated by commas) to which compilation
1175 should be restricted. Only the specified methods will be compiled.
1176 Specify each method with the full class name (including the
1177 packages and subpackages). For example, to compile only the
1178 length() method of the String class and the size() method of the
1179 List class, use the following:
1180
1181 -XX:CompileOnly=java/lang/String.length,java/util/List.size
1182
1183 Note that the full class name is specified, including all packages
1184 and subpackages separated by a slash (/). For easier cut and paste
1185 operations, it is also possible to use the method name format
1186 produced by the -XX:+PrintCompilation and -XX:+LogCompilation
1187 options:
1188
1189 -XX:CompileOnly=java.lang.String::length,java.util.List::size
1190
1191 Although wildcards are not supported, you can specify only the
1192 class or package name to compile all methods in that class or
1193 package, as well as specify just the method to compile methods with
1194 this name in any class:
1195
1196 -XX:CompileOnly=java/lang/String
1197 -XX:CompileOnly=java/lang
1198 -XX:CompileOnly=.length
1199
1200
1201 -XX:CompileThreshold=invocations
1202 Sets the number of interpreted method invocations before
1203 compilation. By default, in the server JVM, the JIT compiler
1204 performs 10,000 interpreted method invocations to gather
1205 information for efficient compilation. For the client JVM, the
1206 default setting is 1,500 invocations. This option is ignored when
1207 tiered compilation is enabled; see the option
1208 -XX:+TieredCompilation. The following example shows how to set the
1209 number of interpreted method invocations to 5,000:
1210
1211 -XX:CompileThreshold=5000
1212
1213 You can completely disable interpretation of Java methods before
1214 compilation by specifying the -Xcomp option.
1215
1216 -XX:+DoEscapeAnalysis
1217 Enables the use of escape analysis. This option is enabled by
1218 default. To disable the use of escape analysis, specify
1219 -XX:-DoEscapeAnalysis. Only the Java HotSpot Server VM supports
1220 this option.
1221
1222 -XX:InitialCodeCacheSize=size
1223 Sets the initial code cache size (in bytes). Append the letter k or
1224 K to indicate kilobytes, m or M to indicate megabytes, g or G to
1225 indicate gigabytes. The default value is set to 500 KB. The initial
1226 code cache size should be not less than the system's minimal memory
1227 page size. The following example shows how to set the initial code
1228 cache size to 32 KB:
1229
1230 -XX:InitialCodeCacheSize=32k
1231
1232
1233 -XX:+Inline
1234 Enables method inlining. This option is enabled by default to
1235 increase performance. To disable method inlining, specify
1236 -XX:-Inline.
1237
1238 -XX:InlineSmallCode=size
1239 Sets the maximum code size (in bytes) for compiled methods that
1240 should be inlined. Append the letter k or K to indicate kilobytes,
1241 m or M to indicate megabytes, g or G to indicate gigabytes. Only
1242 compiled methods with the size smaller than the specified size will
1243 be inlined. By default, the maximum code size is set to 1000 bytes:
1244
1245 -XX:InlineSmallCode=1000
1246
1247
1248 -XX:+LogCompilation
1249 Enables logging of compilation activity to a file named hotspot.log
1250 in the current working directory. You can specify a different log
1251 file path and name using the -XX:LogFile option.
1252
1253 By default, this option is disabled and compilation activity is not
1254 logged. The -XX:+LogCompilation option has to be used together with
1255 the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic
1256 JVM options.
1257
1258 You can enable verbose diagnostic output with a message printed to
1259 the console every time a method is compiled by using the
1260 -XX:+PrintCompilation option.
1261
1262 -XX:MaxInlineSize=size
1263 Sets the maximum bytecode size (in bytes) of a method to be
1264 inlined. Append the letter k or K to indicate kilobytes, m or M to
1265 indicate megabytes, g or G to indicate gigabytes. By default, the
1266 maximum bytecode size is set to 35 bytes:
1267
1268 -XX:MaxInlineSize=35
1269
1270
1271 -XX:MaxNodeLimit=nodes
1272 Sets the maximum number of nodes to be used during single method
1273 compilation. By default, the maximum number of nodes is set to
1274 65,000:
1275
1276 -XX:MaxNodeLimit=65000
1277
1278
1279 -XX:MaxTrivialSize=size
1280 Sets the maximum bytecode size (in bytes) of a trivial method to be
1281 inlined. Append the letter k or K to indicate kilobytes, m or M to
1282 indicate megabytes, g or G to indicate gigabytes. By default, the
1283 maximum bytecode size of a trivial method is set to 6 bytes:
1284
1285 -XX:MaxTrivialSize=6
1286
1287
1288 -XX:+OptimizeStringConcat
1289 Enables the optimization of String concatenation operations. This
1290 option is enabled by default. To disable the optimization of String
1291 concatenation operations, specify -XX:-OptimizeStringConcat. Only
1292 the Java HotSpot Server VM supports this option.
1293
1294 -XX:+PrintAssembly
1295 Enables printing of assembly code for bytecoded and native methods
1296 by using the external disassembler.so library. This enables you to
1297 see the generated code, which may help you to diagnose performance
1298 issues.
1299
1300 By default, this option is disabled and assembly code is not
1301 printed. The -XX:+PrintAssembly option has to be used together with
1302 the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic
1303 JVM options.
1304
1305 -XX:+PrintCompilation
1306 Enables verbose diagnostic output from the JVM by printing a
1307 message to the console every time a method is compiled. This
1308 enables you to see which methods actually get compiled. By default,
1309 this option is disabled and diagnostic output is not printed.
1310
1311 You can also log compilation activity to a file by using the
1312 -XX:+LogCompilation option.
1313
1314 -XX:+PrintInlining
1315 Enables printing of inlining decisions. This enables you to see
1316 which methods are getting inlined.
1317
1318 By default, this option is disabled and inlining information is not
1319 printed. The -XX:+PrintInlining option has to be used together with
1320 the -XX:+UnlockDiagnosticVMOptions option that unlocks diagnostic
1321 JVM options.
1322
1323 -XX:ReservedCodeCacheSize=size
1324 Sets the maximum code cache size (in bytes) for JIT-compiled code.
1325 Append the letter k or K to indicate kilobytes, m or M to indicate
1326 megabytes, g or G to indicate gigabytes. The default maximum code
1327 cache size is 240 MB; if you disable tiered compilation with the
1328 option -XX:-TieredCompilation, then the default size is 48 MB. This
1329 option has a limit of 2 GB; otherwise, an error is generated. The
1330 maximum code cache size should not be less than the initial code
1331 cache size; see the option -XX:InitialCodeCacheSize. This option is
1332 equivalent to -Xmaxjitcodesize.
1333
1334 -XX:RTMAbortRatio=abort_ratio
1335 The RTM abort ratio is specified as a percentage (%) of all
1336 executed RTM transactions. If a number of aborted transactions
1337 becomes greater than this ratio, then the compiled code will be
1338 deoptimized. This ratio is used when the -XX:+UseRTMDeopt option is
1339 enabled. The default value of this option is 50. This means that
1340 the compiled code will be deoptimized if 50% of all transactions
1341 are aborted.
1342
1343 -XX:RTMRetryCount=number_of_retries
1344 RTM locking code will be retried, when it is aborted or busy, the
1345 number of times specified by this option before falling back to the
1346 normal locking mechanism. The default value for this option is 5.
1347 The -XX:UseRTMLocking option must be enabled.
1348
1349 -XX:-TieredCompilation
1350 Disables the use of tiered compilation. By default, this option is
1351 enabled. Only the Java HotSpot Server VM supports this option.
1352
1353 -XX:+UseAES
1354 Enables hardware-based AES intrinsics for Intel, AMD, and SPARC
1355 hardware. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and
1356 newer), and SPARC (T4 and newer) are the supported hardware. UseAES
1357 is used in conjunction with UseAESIntrinsics.
1358
1359 -XX:+UseAESIntrinsics
1360 UseAES and UseAESIntrinsics flags are enabled by default and are
1361 supported only for Java HotSpot Server VM 32-bit and 64-bit. To
1362 disable hardware-based AES intrinsics, specify -XX:-UseAES
1363 -XX:-UseAESIntrinsics. For example, to enable hardware AES, use the
1364 following flags:
1365
1366 -XX:+UseAES -XX:+UseAESIntrinsics
1367
1368 To support UseAES and UseAESIntrinsics flags for 32-bit and 64-bit
1369 use -server option to choose Java HotSpot Server VM. These flags
1370 are not supported on Client VM.
1371
1372 -XX:+UseCodeCacheFlushing
1373 Enables flushing of the code cache before shutting down the
1374 compiler. This option is enabled by default. To disable flushing of
1375 the code cache before shutting down the compiler, specify
1376 -XX:-UseCodeCacheFlushing.
1377
1378 -XX:+UseCondCardMark
1379 Enables checking of whether the card is already marked before
1380 updating the card table. This option is disabled by default and
1381 should only be used on machines with multiple sockets, where it
1382 will increase performance of Java applications that rely heavily on
1383 concurrent operations. Only the Java HotSpot Server VM supports
1384 this option.
1385
1386 -XX:+UseRTMDeopt
1387 Auto-tunes RTM locking depending on the abort ratio. This ratio is
1388 specified by -XX:RTMAbortRatio option. If the number of aborted
1389 transactions exceeds the abort ratio, then the method containing
1390 the lock will be deoptimized and recompiled with all locks as
1391 normal locks. This option is disabled by default. The
1392 -XX:+UseRTMLocking option must be enabled.
1393
1394 -XX:+UseRTMLocking
1395 Generate Restricted Transactional Memory (RTM) locking code for all
1396 inflated locks, with the normal locking mechanism as the fallback
1397 handler. This option is disabled by default. Options related to RTM
1398 are only available for the Java HotSpot Server VM on x86 CPUs that
1399 support Transactional Synchronization Extensions (TSX).
1400
1401 RTM is part of Intel's TSX, which is an x86 instruction set
1402 extension and facilitates the creation of multithreaded
1403 applications. RTM introduces the new instructions XBEGIN, XABORT,
1404 XEND, and XTEST. The XBEGIN and XEND instructions enclose a set of
1405 instructions to run as a transaction. If no conflict is found when
1406 running the transaction, the memory and register modifications are
1407 committed together at the XEND instruction. The XABORT instruction
1408 can be used to explicitly abort a transaction and the XEND
1409 instruction to check if a set of instructions are being run in a
1410 transaction.
1411
1412 A lock on a transaction is inflated when another thread tries to
1413 access the same transaction, thereby blocking the thread that did
1414 not originally request access to the transaction. RTM requires that
1415 a fallback set of operations be specified in case a transaction
1416 aborts or fails. An RTM lock is a lock that has been delegated to
1417 the TSX's system.
1418
1419 RTM improves performance for highly contended locks with low
1420 conflict in a critical region (which is code that must not be
1421 accessed by more than one thread concurrently). RTM also improves
1422 the performance of coarse-grain locking, which typically does not
1423 perform well in multithreaded applications. (Coarse-grain locking
1424 is the strategy of holding locks for long periods to minimize the
1425 overhead of taking and releasing locks, while fine-grained locking
1426 is the strategy of trying to achieve maximum parallelism by locking
1427 only when necessary and unlocking as soon as possible.) Also, for
1428 lightly contended locks that are used by different threads, RTM can
1429 reduce false cache line sharing, also known as cache line
1430 ping-pong. This occurs when multiple threads from different
1431 processors are accessing different resources, but the resources
1432 share the same cache line. As a result, the processors repeatedly
1433 invalidate the cache lines of other processors, which forces them
1434 to read from main memory instead of their cache.
1435
1436 -XX:+UseSHA
1437 Enables hardware-based intrinsics for SHA crypto hash functions for
1438 SPARC hardware. UseSHA is used in conjunction with the
1439 UseSHA1Intrinsics, UseSHA256Intrinsics, and UseSHA512Intrinsics
1440 options.
1441
1442 The UseSHA and UseSHA*Intrinsics flags are enabled by default, and
1443 are supported only for Java HotSpot Server VM 64-bit on SPARC T4
1444 and newer.
1445
1446 This feature is only applicable when using the
1447 sun.security.provider.Sun provider for SHA operations.
1448
1449 To disable all hardware-based SHA intrinsics, specify -XX:-UseSHA.
1450 To disable only a particular SHA intrinsic, use the appropriate
1451 corresponding option. For example: -XX:-UseSHA256Intrinsics.
1452
1453 -XX:+UseSHA1Intrinsics
1454 Enables intrinsics for SHA-1 crypto hash function.
1455
1456 -XX:+UseSHA256Intrinsics
1457 Enables intrinsics for SHA-224 and SHA-256 crypto hash functions.
1458
1459 -XX:+UseSHA512Intrinsics
1460 Enables intrinsics for SHA-384 and SHA-512 crypto hash functions.
1461
1462 -XX:+UseSuperWord
1463 Enables the transformation of scalar operations into superword
1464 operations. This option is enabled by default. To disable the
1465 transformation of scalar operations into superword operations,
1466 specify -XX:-UseSuperWord. Only the Java HotSpot Server VM supports
1467 this option.
1468
1469 Advanced Serviceability Options
1470 These options provide the ability to gather system information and
1471 perform extensive debugging.
1472
1473 -XX:+ExtendedDTraceProbes
1474 Enables additional dtrace tool probes that impact the performance.
1475 By default, this option is disabled and dtrace performs only
1476 standard probes.
1477
1478 -XX:+HeapDumpOnOutOfMemory
1479 Enables the dumping of the Java heap to a file in the current
1480 directory by using the heap profiler (HPROF) when a
1481 java.lang.OutOfMemoryError exception is thrown. You can explicitly
1482 set the heap dump file path and name using the -XX:HeapDumpPath
1483 option. By default, this option is disabled and the heap is not
1484 dumped when an OutOfMemoryError exception is thrown.
1485
1486 -XX:HeapDumpPath=path
1487 Sets the path and file name for writing the heap dump provided by
1488 the heap profiler (HPROF) when the -XX:+HeapDumpOnOutOfMemoryError
1489 option is set. By default, the file is created in the current
1490 working directory, and it is named java_pidpid.hprof where pid is
1491 the identifier of the process that caused the error. The following
1492 example shows how to set the default file explicitly (%p represents
1493 the current process identificator):
1494
1495 -XX:HeapDumpPath=./java_pid%p.hprof
1496
1497 The following example shows how to set the heap dump file to
1498 /var/log/java/java_heapdump.hprof:
1499
1500 -XX:HeapDumpPath=/var/log/java/java_heapdump.hprof
1501
1502
1503 -XX:LogFile=path
1504 Sets the path and file name where log data is written. By default,
1505 the file is created in the current working directory, and it is
1506 named hotspot.log.
1507
1508 The following example shows how to set the log file to
1509 /var/log/java/hotspot.log:
1510
1511 -XX:LogFile=/var/log/java/hotspot.log
1512
1513
1514 -XX:+PrintClassHistogram
1515 Enables printing of a class instance histogram after a Control+C
1516 event (SIGTERM). By default, this option is disabled.
1517
1518 Setting this option is equivalent to running the jmap -histo
1519 command, or the jcmd pid GC.class_histogram command, where pid is
1520 the current Java process identifier.
1521
1522 -XX:+PrintConcurrentLocks
1523 Enables printing of locks after a event. By default, this option is
1524 disabled.
1525
1526 Enables printing of java.util.concurrent locks after a Control+C
1527 event (SIGTERM). By default, this option is disabled.
1528
1529 Setting this option is equivalent to running the jstack -l command
1530 or the jcmd pid Thread.print -l command, where pid is the current
1531 Java process identifier.
1532
1533 -XX:+UnlockDiagnosticVMOptions
1534 Unlocks the options intended for diagnosing the JVM. By default,
1535 this option is disabled and diagnostic options are not available.
1536
1537 Advanced Garbage Collection Options
1538 These options control how garbage collection (GC) is performed by the
1539 Java HotSpot VM.
1540
1541 -XX:+AggressiveHeap
1542 Enables Java heap optimization. This sets various parameters to be
1543 optimal for long-running jobs with intensive memory allocation,
1544 based on the configuration of the computer (RAM and CPU). By
1545 default, the option is disabled and the heap is not optimized.
1546
1547 -XX:+AlwaysPreTouch
1548 Enables touching of every page on the Java heap during JVM
1549 initialization. This gets all pages into the memory before entering
1550 the main() method. The option can be used in testing to simulate a
1551 long-running system with all virtual memory mapped to physical
1552 memory. By default, this option is disabled and all pages are
1553 committed as JVM heap space fills.
1554
1555 -XX:+CMSClassUnloadingEnabled
1556 Enables class unloading when using the concurrent mark-sweep (CMS)
1557 garbage collector. This option is enabled by default. To disable
1558 class unloading for the CMS garbage collector, specify
1559 -XX:-CMSClassUnloadingEnabled.
1560
1561 -XX:CMSExpAvgFactor=percent
1562 Sets the percentage of time (0 to 100) used to weight the current
1563 sample when computing exponential averages for the concurrent
1564 collection statistics. By default, the exponential averages factor
1565 is set to 25%. The following example shows how to set the factor to
1566 15%:
1567
1568 -XX:CMSExpAvgFactor=15
1569
1570
1571 -XX:CMSInitiatingOccupancyFraction=percent
1572 Sets the percentage of the old generation occupancy (0 to 100) at
1573 which to start a CMS collection cycle. The default value is set to
1574 -1. Any negative value (including the default) implies that
1575 -XX:CMSTriggerRatio is used to define the value of the initiating
1576 occupancy fraction.
1577
1578 The following example shows how to set the occupancy fraction to
1579 20%:
1580
1581 -XX:CMSInitiatingOccupancyFraction=20
1582
1583
1584 -XX:+CMSScavengeBeforeRemark
1585 Enables scavenging attempts before the CMS remark step. By default,
1586 this option is disabled.
1587
1588 -XX:CMSTriggerRatio=percent
1589 Sets the percentage (0 to 100) of the value specified by
1590 -XX:MinHeapFreeRatio that is allocated before a CMS collection
1591 cycle commences. The default value is set to 80%.
1592
1593 The following example shows how to set the occupancy fraction to
1594 75%:
1595
1596 -XX:CMSTriggerRatio=75
1597
1598
1599 -XX:ConcGCThreads=threads
1600 Sets the number of threads used for concurrent GC. The default
1601 value depends on the number of CPUs available to the JVM.
1602
1603 For example, to set the number of threads for concurrent GC to 2,
1604 specify the following option:
1605
1606 -XX:ConcGCThreads=2
1607
1608
1609 -XX:+DisableExplicitGC
1610 Enables the option that disables processing of calls to
1611 System.gc(). This option is disabled by default, meaning that calls
1612 to System.gc() are processed. If processing of calls to System.gc()
1613 is disabled, the JVM still performs GC when necessary.
1614
1615 -XX:+ExplicitGCInvokesConcurrent
1616 Enables invoking of concurrent GC by using the System.gc() request.
1617 This option is disabled by default and can be enabled only together
1618 with the -XX:+UseConcMarkSweepGC option.
1619
1620 -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
1621 Enables invoking of concurrent GC by using the System.gc() request
1622 and unloading of classes during the concurrent GC cycle. This
1623 option is disabled by default and can be enabled only together with
1624 the -XX:+UseConcMarkSweepGC option.
1625
1626 -XX:G1HeapRegionSize=size
1627 Sets the size of the regions into which the Java heap is subdivided
1628 when using the garbage-first (G1) collector. The value can be
1629 between 1 MB and 32 MB. The default region size is determined
1630 ergonomically based on the heap size.
1631
1632 The following example shows how to set the size of the subdivisions
1633 to 16 MB:
1634
1635 -XX:G1HeapRegionSize=16m
1636
1637
1638 -XX:+G1PrintHeapRegions
1639 Enables the printing of information about which regions are
1640 allocated and which are reclaimed by the G1 collector. By default,
1641 this option is disabled.
1642
1643 -XX:G1ReservePercent=percent
1644 Sets the percentage of the heap (0 to 50) that is reserved as a
1645 false ceiling to reduce the possibility of promotion failure for
1646 the G1 collector. By default, this option is set to 10%.
1647
1648 The following example shows how to set the reserved heap to 20%:
1649
1650 -XX:G1ReservePercent=20
1651
1652
1653 -XX:InitialHeapSize=size
1654 Sets the initial size (in bytes) of the memory allocation pool.
1655 This value must be either 0, or a multiple of 1024 and greater than
1656 1 MB. Append the letter k or K to indicate kilobytes, m or M to
1657 indicate megabytes, g or G to indicate gigabytes. The default value
1658 is chosen at runtime based on system configuration. See the section
1659 "Ergonomics" in Java SE HotSpot Virtual Machine Garbage Collection
1660 Tuning Guide at
1661 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.
1662
1663 The following examples show how to set the size of allocated memory
1664 to 6 MB using various units:
1665
1666 -XX:InitialHeapSize=6291456
1667 -XX:InitialHeapSize=6144k
1668 -XX:InitialHeapSize=6m
1669
1670 If you set this option to 0, then the initial size will be set as
1671 the sum of the sizes allocated for the old generation and the young
1672 generation. The size of the heap for the young generation can be
1673 set using the -XX:NewSize option.
1674
1675 -XX:InitialSurvivorRatio=ratio
1676 Sets the initial survivor space ratio used by the throughput
1677 garbage collector (which is enabled by the -XX:+UseParallelGC
1678 and/or -XX:+UseParallelOldGC options). Adaptive sizing is enabled
1679 by default with the throughput garbage collector by using the
1680 -XX:+UseParallelGC and -XX:+UseParallelOldGC options, and survivor
1681 space is resized according to the application behavior, starting
1682 with the initial value. If adaptive sizing is disabled (using the
1683 -XX:-UseAdaptiveSizePolicy option), then the -XX:SurvivorRatio
1684 option should be used to set the size of the survivor space for the
1685 entire execution of the application.
1686
1687 The following formula can be used to calculate the initial size of
1688 survivor space (S) based on the size of the young generation (Y),
1689 and the initial survivor space ratio (R):
1690
1691 S=Y/(R+2)
1692
1693 The 2 in the equation denotes two survivor spaces. The larger the
1694 value specified as the initial survivor space ratio, the smaller
1695 the initial survivor space size.
1696
1697 By default, the initial survivor space ratio is set to 8. If the
1698 default value for the young generation space size is used (2 MB),
1699 the initial size of the survivor space will be 0.2 MB.
1700
1701 The following example shows how to set the initial survivor space
1702 ratio to 4:
1703
1704 -XX:InitialSurvivorRatio=4
1705
1706
1707 -XX:InitiatingHeapOccupancyPercent=percent
1708 Sets the percentage of the heap occupancy (0 to 100) at which to
1709 start a concurrent GC cycle. It is used by garbage collectors that
1710 trigger a concurrent GC cycle based on the occupancy of the entire
1711 heap, not just one of the generations (for example, the G1 garbage
1712 collector).
1713
1714 By default, the initiating value is set to 45%. A value of 0
1715 implies nonstop GC cycles. The following example shows how to set
1716 the initiating heap occupancy to 75%:
1717
1718 -XX:InitiatingHeapOccupancyPercent=75
1719
1720
1721 -XX:MaxGCPauseMillis=time
1722 Sets a target for the maximum GC pause time (in milliseconds). This
1723 is a soft goal, and the JVM will make its best effort to achieve
1724 it. By default, there is no maximum pause time value.
1725
1726 The following example shows how to set the maximum target pause
1727 time to 500 ms:
1728
1729 -XX:MaxGCPauseMillis=500
1730
1731
1732 -XX:MaxHeapSize=size
1733 Sets the maximum size (in byes) of the memory allocation pool. This
1734 value must be a multiple of 1024 and greater than 2 MB. Append the
1735 letter k or K to indicate kilobytes, m or M to indicate megabytes,
1736 g or G to indicate gigabytes. The default value is chosen at
1737 runtime based on system configuration. For server deployments,
1738 -XX:InitialHeapSize and -XX:MaxHeapSize are often set to the same
1739 value. See the section "Ergonomics" in Java SE HotSpot Virtual
1740 Machine Garbage Collection Tuning Guide at
1741 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.
1742
1743 The following examples show how to set the maximum allowed size of
1744 allocated memory to 80 MB using various units:
1745
1746 -XX:MaxHeapSize=83886080
1747 -XX:MaxHeapSize=81920k
1748 -XX:MaxHeapSize=80m
1749
1750 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper
1751 limit for this value is approximately 4,000 MB minus overhead
1752 amounts. On Oracle Solaris 2.6 and x86 platforms, the upper limit
1753 is approximately 2,000 MB minus overhead amounts. On Linux
1754 platforms, the upper limit is approximately 2,000 MB minus overhead
1755 amounts.
1756
1757 The -XX:MaxHeapSize option is equivalent to -Xmx.
1758
1759 -XX:MaxHeapFreeRatio=percent
1760 Sets the maximum allowed percentage of free heap space (0 to 100)
1761 after a GC event. If free heap space expands above this value, then
1762 the heap will be shrunk. By default, this value is set to 70%.
1763
1764 The following example shows how to set the maximum free heap ratio
1765 to 75%:
1766
1767 -XX:MaxHeapFreeRatio=75
1768
1769
1770 -XX:MaxMetaspaceSize=size
1771 Sets the maximum amount of native memory that can be allocated for
1772 class metadata. By default, the size is not limited. The amount of
1773 metadata for an application depends on the application itself,
1774 other running applications, and the amount of memory available on
1775 the system.
1776
1777 The following example shows how to set the maximum class metadata
1778 size to 256 MB:
1779
1780 -XX:MaxMetaspaceSize=256m
1781
1782
1783 -XX:MaxNewSize=size
1784 Sets the maximum size (in bytes) of the heap for the young
1785 generation (nursery). The default value is set ergonomically.
1786
1787 -XX:MaxTenuringThreshold=threshold
1788 Sets the maximum tenuring threshold for use in adaptive GC sizing.
1789 The largest value is 15. The default value is 15 for the parallel
1790 (throughput) collector, and 6 for the CMS collector.
1791
1792 The following example shows how to set the maximum tenuring
1793 threshold to 10:
1794
1795 -XX:MaxTenuringThreshold=10
1796
1797
1798 -XX:MetaspaceSize=size
1799 Sets the size of the allocated class metadata space that will
1800 trigger a garbage collection the first time it is exceeded. This
1801 threshold for a garbage collection is increased or decreased
1802 depending on the amount of metadata used. The default size depends
1803 on the platform.
1804
1805 -XX:MinHeapFreeRatio=percent
1806 Sets the minimum allowed percentage of free heap space (0 to 100)
1807 after a GC event. If free heap space falls below this value, then
1808 the heap will be expanded. By default, this value is set to 40%.
1809
1810 The following example shows how to set the minimum free heap ratio
1811 to 25%:
1812
1813 -XX:MinHeapFreeRatio=25
1814
1815
1816 -XX:NewRatio=ratio
1817 Sets the ratio between young and old generation sizes. By default,
1818 this option is set to 2. The following example shows how to set the
1819 young/old ratio to 1:
1820
1821 -XX:NewRatio=1
1822
1823
1824 -XX:NewSize=size
1825 Sets the initial size (in bytes) of the heap for the young
1826 generation (nursery). Append the letter k or K to indicate
1827 kilobytes, m or M to indicate megabytes, g or G to indicate
1828 gigabytes.
1829
1830 The young generation region of the heap is used for new objects. GC
1831 is performed in this region more often than in other regions. If
1832 the size for the young generation is too low, then a large number
1833 of minor GCs will be performed. If the size is too high, then only
1834 full GCs will be performed, which can take a long time to complete.
1835 Oracle recommends that you keep the size for the young generation
1836 between a half and a quarter of the overall heap size.
1837
1838 The following examples show how to set the initial size of young
1839 generation to 256 MB using various units:
1840
1841 -XX:NewSize=256m
1842 -XX:NewSize=262144k
1843 -XX:NewSize=268435456
1844
1845 The -XX:NewSize option is equivalent to -Xmn.
1846
1847 -XX:ParallelGCThreads=threads
1848 Sets the number of threads used for parallel garbage collection in
1849 the young and old generations. The default value depends on the
1850 number of CPUs available to the JVM.
1851
1852 For example, to set the number of threads for parallel GC to 2,
1853 specify the following option:
1854
1855 -XX:ParallelGCThreads=2
1856
1857
1858 -XX:+ParallelRefProcEnabled
1859 Enables parallel reference processing. By default, this option is
1860 disabled.
1861
1862 -XX:+PrintAdaptiveSizePolicy
1863 Enables printing of information about adaptive generation sizing.
1864 By default, this option is disabled.
1865
1866 -XX:+PrintGC
1867 Enables printing of messages at every GC. By default, this option
1868 is disabled.
1869
1870 -XX:+PrintGCApplicationConcurrentTime
1871 Enables printing of how much time elapsed since the last pause (for
1872 example, a GC pause). By default, this option is disabled.
1873
1874 -XX:+PrintGCApplicationStoppedTime
1875 Enables printing of how much time the pause (for example, a GC
1876 pause) lasted. By default, this option is disabled.
1877
1878 -XX:+PrintGCDateStamps
1879 Enables printing of a date stamp at every GC. By default, this
1880 option is disabled.
1881
1882 -XX:+PrintGCDetails
1883 Enables printing of detailed messages at every GC. By default, this
1884 option is disabled.
1885
1886 -XX:+PrintGCTaskTimeStamps
1887 Enables printing of time stamps for every individual GC worker
1888 thread task. By default, this option is disabled.
1889
1890 -XX:+PrintGCTimeStamps
1891 Enables printing of time stamps at every GC. By default, this
1892 option is disabled.
1893
1894 -XX:+PrintStringDeduplicationStatistics
1895 Prints detailed deduplication statistics. By default, this option
1896 is disabled. See the -XX:+UseStringDeduplication option.
1897
1898 -XX:+PrintTenuringDistribution
1899 Enables printing of tenuring age information. The following is an
1900 example of the output:
1901
1902 Desired survivor size 48286924 bytes, new threshold 10 (max 10)
1903 - age 1: 28992024 bytes, 28992024 total
1904 - age 2: 1366864 bytes, 30358888 total
1905 - age 3: 1425912 bytes, 31784800 total
1906 ...
1907
1908 Age 1 objects are the youngest survivors (they were created after
1909 the previous scavenge, survived the latest scavenge, and moved from
1910 eden to survivor space). Age 2 objects have survived two scavenges
1911 (during the second scavenge they were copied from one survivor
1912 space to the next). And so on.
1913
1914 In the preceding example, 28 992 024 bytes survived one scavenge
1915 and were copied from eden to survivor space, 1 366 864 bytes are
1916 occupied by age 2 objects, etc. The third value in each row is the
1917 cumulative size of objects of age n or less.
1918
1919 By default, this option is disabled.
1920
1921 -XX:+ScavengeBeforeFullGC
1922 Enables GC of the young generation before each full GC. This option
1923 is enabled by default. Oracle recommends that you do not disable
1924 it, because scavenging the young generation before a full GC can
1925 reduce the number of objects reachable from the old generation
1926 space into the young generation space. To disable GC of the young
1927 generation before each full GC, specify -XX:-ScavengeBeforeFullGC.
1928
1929 -XX:SoftRefLRUPolicyMSPerMB=time
1930 Sets the amount of time (in milliseconds) a softly reachable object
1931 is kept active on the heap after the last time it was referenced.
1932 The default value is one second of lifetime per free megabyte in
1933 the heap. The -XX:SoftRefLRUPolicyMSPerMB option accepts integer
1934 values representing milliseconds per one megabyte of the current
1935 heap size (for Java HotSpot Client VM) or the maximum possible heap
1936 size (for Java HotSpot Server VM). This difference means that the
1937 Client VM tends to flush soft references rather than grow the heap,
1938 whereas the Server VM tends to grow the heap rather than flush soft
1939 references. In the latter case, the value of the -Xmx option has a
1940 significant effect on how quickly soft references are garbage
1941 collected.
1942
1943 The following example shows how to set the value to 2.5 seconds:
1944
1945 -XX:SoftRefLRUPolicyMSPerMB=2500
1946
1947
1948 -XX:StringDeduplicationAgeThreshold=threshold
1949 String objects reaching the specified age are considered candidates
1950 for deduplication. An object's age is a measure of how many times
1951 it has survived garbage collection. This is sometimes referred to
1952 as tenuring; see the -XX:+PrintTenuringDistribution option. Note
1953 that String objects that are promoted to an old heap region before
1954 this age has been reached are always considered candidates for
1955 deduplication. The default value for this option is 3. See the
1956 -XX:+UseStringDeduplication option.
1957
1958 -XX:SurvivorRatio=ratio
1959 Sets the ratio between eden space size and survivor space size. By
1960 default, this option is set to 8. The following example shows how
1961 to set the eden/survivor space ratio to 4:
1962
1963 -XX:SurvivorRatio=4
1964
1965
1966 -XX:TargetSurvivorRatio=percent
1967 Sets the desired percentage of survivor space (0 to 100) used after
1968 young garbage collection. By default, this option is set to 50%.
1969
1970 The following example shows how to set the target survivor space
1971 ratio to 30%:
1972
1973 -XX:TargetSurvivorRatio=30
1974
1975
1976 -XX:TLABSize=size
1977 Sets the initial size (in bytes) of a thread-local allocation
1978 buffer (TLAB). Append the letter k or K to indicate kilobytes, m or
1979 M to indicate megabytes, g or G to indicate gigabytes. If this
1980 option is set to 0, then the JVM chooses the initial size
1981 automatically.
1982
1983 The following example shows how to set the initial TLAB size to 512
1984 KB:
1985
1986 -XX:TLABSize=512k
1987
1988
1989 -XX:+UseAdaptiveSizePolicy
1990 Enables the use of adaptive generation sizing. This option is
1991 enabled by default. To disable adaptive generation sizing, specify
1992 -XX:-UseAdaptiveSizePolicy and set the size of the memory
1993 allocation pool explicitly (see the -XX:SurvivorRatio option).
1994
1995 -XX:+UseCMSInitiatingOccupancyOnly
1996 Enables the use of the occupancy value as the only criterion for
1997 initiating the CMS collector. By default, this option is disabled
1998 and other criteria may be used.
1999
2000 -XX:+UseConcMarkSweepGC
2001 Enables the use of the CMS garbage collector for the old
2002 generation. Oracle recommends that you use the CMS garbage
2003 collector when application latency requirements cannot be met by
2004 the throughput (-XX:+UseParallelGC) garbage collector. The G1
2005 garbage collector (-XX:+UseG1GC) is another alternative.
2006
2007 By default, this option is disabled and the collector is chosen
2008 automatically based on the configuration of the machine and type of
2009 the JVM. When this option is enabled, the -XX:+UseParNewGC option
2010 is automatically set and you should not disable it, because the
2011 following combination of options has been deprecated in JDK 8:
2012 -XX:+UseConcMarkSweepGC -XX:-UseParNewGC.
2013
2014 -XX:+UseG1GC
2015 Enables the use of the garbage-first (G1) garbage collector. It is
2016 a server-style garbage collector, targeted for multiprocessor
2017 machines with a large amount of RAM. It meets GC pause time goals
2018 with high probability, while maintaining good throughput. The G1
2019 collector is recommended for applications requiring large heaps
2020 (sizes of around 6 GB or larger) with limited GC latency
2021 requirements (stable and predictable pause time below 0.5 seconds).
2022
2023 By default, this option is disabled and the collector is chosen
2024 automatically based on the configuration of the machine and type of
2025 the JVM.
2026
2027 -XX:+UseGCOverheadLimit
2028 Enables the use of a policy that limits the proportion of time
2029 spent by the JVM on GC before an OutOfMemoryError exception is
2030 thrown. This option is enabled, by default and the parallel GC will
2031 throw an OutOfMemoryError if more than 98% of the total time is
2032 spent on garbage collection and less than 2% of the heap is
2033 recovered. When the heap is small, this feature can be used to
2034 prevent applications from running for long periods of time with
2035 little or no progress. To disable this option, specify
2036 -XX:-UseGCOverheadLimit.
2037
2038 -XX:+UseNUMA
2039 Enables performance optimization of an application on a machine
2040 with nonuniform memory architecture (NUMA) by increasing the
2041 application's use of lower latency memory. By default, this option
2042 is disabled and no optimization for NUMA is made. The option is
2043 only available when the parallel garbage collector is used
2044 (-XX:+UseParallelGC).
2045
2046 -XX:+UseParallelGC
2047 Enables the use of the parallel scavenge garbage collector (also
2048 known as the throughput collector) to improve the performance of
2049 your application by leveraging multiple processors.
2050
2051 By default, this option is disabled and the collector is chosen
2052 automatically based on the configuration of the machine and type of
2053 the JVM. If it is enabled, then the -XX:+UseParallelOldGC option is
2054 automatically enabled, unless you explicitly disable it.
2055
2056 -XX:+UseParallelOldGC
2057 Enables the use of the parallel garbage collector for full GCs. By
2058 default, this option is disabled. Enabling it automatically enables
2059 the -XX:+UseParallelGC option.
2060
2061 -XX:+UseParNewGC
2062 Enables the use of parallel threads for collection in the young
2063 generation. By default, this option is disabled. It is
2064 automatically enabled when you set the -XX:+UseConcMarkSweepGC
2065 option. Using the -XX:+UseParNewGC option without the
2066 -XX:+UseConcMarkSweepGC option was deprecated in JDK 8.
2067
2068 -XX:+UseSerialGC
2069 Enables the use of the serial garbage collector. This is generally
2070 the best choice for small and simple applications that do not
2071 require any special functionality from garbage collection. By
2072 default, this option is disabled and the collector is chosen
2073 automatically based on the configuration of the machine and type of
2074 the JVM.
2075
2076 -XX:+UseSHM
2077 On Linux, enables the JVM to use shared memory to setup large
2078 pages.
2079
2080 For more information, see "Large Pages".
2081
2082 -XX:+UseStringDeduplication
2083 Enables string deduplication. By default, this option is disabled.
2084 To use this option, you must enable the garbage-first (G1) garbage
2085 collector. See the -XX:+UseG1GC option.
2086
2087 String deduplication reduces the memory footprint of String objects
2088 on the Java heap by taking advantage of the fact that many String
2089 objects are identical. Instead of each String object pointing to
2090 its own character array, identical String objects can point to and
2091 share the same character array.
2092
2093 -XX:+UseTLAB
2094 Enables the use of thread-local allocation blocks (TLABs) in the
2095 young generation space. This option is enabled by default. To
2096 disable the use of TLABs, specify -XX:-UseTLAB.
2097
2098 Deprecated and Removed Options
2099 These options were included in the previous release, but have since
2100 been considered unnecessary.
2101
2102 -Xincgc
2103 Enables incremental garbage collection. This option was deprecated
2104 in JDK 8 with no replacement.
2105
2106 -Xrunlibname
2107 Loads the specified debugging/profiling library. This option was
2108 superseded by the -agentlib option.
2109
2110 -XX:CMSIncrementalDutyCycle=percent
2111 Sets the percentage of time (0 to 100) between minor collections
2112 that the concurrent collector is allowed to run. This option was
2113 deprecated in JDK 8 with no replacement, following the deprecation
2114 of the -XX:+CMSIncrementalMode option.
2115
2116 -XX:CMSIncrementalDutyCycleMin=percent
2117 Sets the percentage of time (0 to 100) between minor collections
2118 that is the lower bound for the duty cycle when
2119 -XX:+CMSIncrementalPacing is enabled. This option was deprecated in
2120 JDK 8 with no replacement, following the deprecation of the
2121 -XX:+CMSIncrementalMode option.
2122
2123 -XX:+CMSIncrementalMode
2124 Enables the incremental mode for the CMS collector. This option was
2125 deprecated in JDK 8 with no replacement, along with other options
2126 that start with CMSIncremental.
2127
2128 -XX:CMSIncrementalOffset=percent
2129 Sets the percentage of time (0 to 100) by which the incremental
2130 mode duty cycle is shifted to the right within the period between
2131 minor collections. This option was deprecated in JDK 8 with no
2132 replacement, following the deprecation of the
2133 -XX:+CMSIncrementalMode option.
2134
2135 -XX:+CMSIncrementalPacing
2136 Enables automatic adjustment of the incremental mode duty cycle
2137 based on statistics collected while the JVM is running. This option
2138 was deprecated in JDK 8 with no replacement, following the
2139 deprecation of the -XX:+CMSIncrementalMode option.
2140
2141 -XX:CMSIncrementalSafetyFactor=percent
2142 Sets the percentage of time (0 to 100) used to add conservatism
2143 when computing the duty cycle. This option was deprecated in JDK 8
2144 with no replacement, following the deprecation of the
2145 -XX:+CMSIncrementalMode option.
2146
2147 -XX:CMSInitiatingPermOccupancyFraction=percent
2148 Sets the percentage of the permanent generation occupancy (0 to
2149 100) at which to start a GC. This option was deprecated in JDK 8
2150 with no replacement.
2151
2152 -XX:MaxPermSize=size
2153 Sets the maximum permanent generation space size (in bytes). This
2154 option was deprecated in JDK 8, and superseded by the
2155 -XX:MaxMetaspaceSize option.
2156
2157 -XX:PermSize=size
2158 Sets the space (in bytes) allocated to the permanent generation
2159 that triggers a garbage collection if it is exceeded. This option
2160 was deprecated un JDK 8, and superseded by the -XX:MetaspaceSize
2161 option.
2162
2163 -XX:+UseSplitVerifier
2164 Enables splitting of the verification process. By default, this
2165 option was enabled in the previous releases, and verification was
2166 split into two phases: type referencing (performed by the compiler)
2167 and type checking (performed by the JVM runtime). This option was
2168 deprecated in JDK 8, and verification is now split by default
2169 without a way to disable it.
2170
2171 -XX:+UseStringCache
2172 Enables caching of commonly allocated strings. This option was
2173 removed from JDK 8 with no replacement.
2174
2176 The following examples show how to use experimental tuning flags to
2177 either optimize throughput or to provide lower response time.
2178
2179 Example 1 Tuning for Higher Throughput
2180
2181 java -d64 -server -XX:+AggressiveOpts -XX:+UseLargePages -Xmn10g -Xms26g -Xmx26g
2182
2183
2184 Example 2 Tuning for Lower Response Time
2185
2186 java -d64 -XX:+UseG1GC -Xms26g Xmx26g -XX:MaxGCPauseMillis=500 -XX:+PrintGCTimeStamp
2187
2188
2190 Also known as huge pages, large pages are memory pages that are
2191 significantly larger than the standard memory page size (which varies
2192 depending on the processor and operating system). Large pages optimize
2193 processor Translation-Lookaside Buffers.
2194
2195 A Translation-Lookaside Buffer (TLB) is a page translation cache that
2196 holds the most-recently used virtual-to-physical address translations.
2197 TLB is a scarce system resource. A TLB miss can be costly as the
2198 processor must then read from the hierarchical page table, which may
2199 require multiple memory accesses. By using a larger memory page size, a
2200 single TLB entry can represent a larger memory range. There will be
2201 less pressure on TLB, and memory-intensive applications may have better
2202 performance.
2203
2204 However, large pages page memory can negatively affect system
2205 performance. For example, when a large mount of memory is pinned by an
2206 application, it may create a shortage of regular memory and cause
2207 excessive paging in other applications and slow down the entire system.
2208 Also, a system that has been up for a long time could produce excessive
2209 fragmentation, which could make it impossible to reserve enough large
2210 page memory. When this happens, either the OS or JVM reverts to using
2211 regular pages.
2212
2213 Large Pages Support
2214 Solaris and Linux support large pages.
2215
2216 Solaris
2217 Solaris 9 and later include Multiple Page Size Support (MPSS); no
2218 additional configuration is necessary. See
2219 http://www.oracle.com/technetwork/server-storage/solaris10/overview/solaris9-features-scalability-135663.html.
2220
2221 Linux
2222 The 2.6 kernel supports large pages. Some vendors have backported
2223 the code to their 2.4-based releases. To check if your system can
2224 support large page memory, try the following:
2225
2226 # cat /proc/meminfo | grep Huge
2227 HugePages_Total: 0
2228 HugePages_Free: 0
2229 Hugepagesize: 2048 kB
2230
2231
2232 If the output shows the three "Huge" variables, then your system
2233 can support large page memory but it needs to be configured. If the
2234 command prints nothing, then your system does not support large
2235 pages. To configure the system to use large page memory, login as
2236 root, and then follow these steps:
2237
2238 1. If you are using the option -XX:+UseSHM (instead of
2239 -XX:+UseHugeTLBFS), then increase the SHMMAX value. It must be
2240 larger than the Java heap size. On a system with 4 GB of
2241 physical RAM (or less), the following will make all the memory
2242 sharable:
2243
2244 # echo 4294967295 > /proc/sys/kernel/shmmax
2245
2246
2247 2. If you are using the option -XX:+UseSHM or -XX:+UseHugeTLBFS,
2248 then specify the number of large pages. In the following
2249 example, 3 GB of a 4 GB system are reserved for large pages
2250 (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB
2251 = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048
2252 kB = 1536):
2253
2254 # echo 1536 > /proc/sys/vm/nr_hugepages
2255
2256
2257 Note
2258 ┌──────────────────────────────────────────────┐
2259 │ │
2260 │ · Note that the values │
2261 │ contained in /proc │
2262 │ will reset after you │
2263 │ reboot your system, │
2264 │ so may want to set │
2265 │ them in an │
2266 │ initialization │
2267 │ script (for example, │
2268 │ rc.local or │
2269 │ sysctl.conf). │
2270 │ │
2271 │ · If you configure (or │
2272 │ resize) the OS │
2273 │ kernel parameters │
2274 │ /proc/sys/kernel/shmmax │
2275 │ or │
2276 │ /proc/sys/vm/nr_hugepages, │
2277 │ Java processes may │
2278 │ allocate large pages │
2279 │ for areas in │
2280 │ addition to the Java │
2281 │ heap. These steps │
2282 │ can allocate large │
2283 │ pages for the │
2284 │ following areas: │
2285 │ │
2286 │ · Java heap │
2287 │ │
2288 │ · Code cache │
2289 │ │
2290 │ · The marking │
2291 │ bitmap data │
2292 │ structure for │
2293 │ the parallel GC │
2294 │ │
2295 │ Consequently, if you │
2296 │ configure the │
2297 │ nr_hugepages │
2298 │ parameter to the │
2299 │ size of the Java │
2300 │ heap, then the JVM │
2301 │ can fail in │
2302 │ allocating the code │
2303 │ cache areas on large │
2304 │ pages because these │
2305 │ areas are quite │
2306 │ large in size. │
2307 └──────────────────────────────────────────────┘
2308
2310 The following exit values are typically returned by the launcher when
2311 the launcher is called with the wrong arguments, serious errors, or
2312 exceptions thrown by the JVM. However, a Java application may choose to
2313 return any value by using the API call System.exit(exitValue). The
2314 values are:
2315
2316 · 0: Successful completion
2317
2318 · >0: An error occurred
2319
2321 · javac(1)
2322
2323 · jdb(1)
2324
2325 · jar(1)
2326
2327 · jstat(1)
2328
2329
2330
2331JDK 8 03 March 2015 java(1)