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 -Xprof
543 Profiles the running program and sends profiling data to standard
544 output. This option is provided as a utility that is useful in
545 program development and is not intended to be used in production
546 systems.
547
548 -Xrs
549 Reduces the use of operating system signals by the JVM.
550
551 Shutdown hooks enable orderly shutdown of a Java application by
552 running user cleanup code (such as closing database connections) at
553 shutdown, even if the JVM terminates abruptly.
554
555 The JVM catches signals to implement shutdown hooks for unexpected
556 termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate
557 the running of shutdown hooks.
558
559 The JVM uses a similar mechanism to implement the feature of
560 dumping thread stacks for debugging purposes. The JVM uses SIGQUIT
561 to perform thread dumps.
562
563 Applications embedding the JVM frequently need to trap signals such
564 as SIGINT or SIGTERM, which can lead to interference with the JVM
565 signal handlers. The -Xrs option is available to address this
566 issue. When -Xrs is used, the signal masks for SIGINT, SIGTERM,
567 SIGHUP, and SIGQUIT are not changed by the JVM, and signal handlers
568 for these signals are not installed.
569
570 There are two consequences of specifying -Xrs:
571
572 · SIGQUIT thread dumps are not available.
573
574 · User code is responsible for causing shutdown hooks to run, for
575 example, by calling System.exit() when the JVM is to be
576 terminated.
577
578 -Xshare:mode
579 Sets the class data sharing (CDS) mode. Possible mode arguments for
580 this option include the following:
581
582 auto
583 Use CDS if possible. This is the default value for Java HotSpot
584 32-Bit Client VM.
585
586 on
587 Require the use of CDS. Print an error message and exit if
588 class data sharing cannot be used.
589
590 off
591 Do not use CDS. This is the default value for Java HotSpot
592 32-Bit Server VM, Java HotSpot 64-Bit Client VM, and Java
593 HotSpot 64-Bit Server VM.
594
595 dump
596 Manually generate the CDS archive. Specify the application
597 class path as described in "Setting the Class Path ".
598
599 You should regenerate the CDS archive with each new JDK
600 release.
601
602 -XshowSettings:category
603 Shows settings and continues. Possible category arguments for this
604 option include the following:
605
606 all
607 Shows all categories of settings. This is the default value.
608
609 locale
610 Shows settings related to locale.
611
612 properties
613 Shows settings related to system properties.
614
615 vm
616 Shows the settings of the JVM.
617
618 -Xsssize
619 Sets the thread stack size (in bytes). Append the letter k or K to
620 indicate KB, m or M to indicate MB, g or G to indicate GB. The
621 default value depends on the platform:
622
623 · Linux/ARM (32-bit): 320 KB
624
625 · Linux/i386 (32-bit): 320 KB
626
627 · Linux/x64 (64-bit): 1024 KB
628
629 · OS X (64-bit): 1024 KB
630
631 · Oracle Solaris/i386 (32-bit): 320 KB
632
633 · Oracle Solaris/x64 (64-bit): 1024 KB
634
635 The following examples set the thread stack size to 1024 KB in
636 different units:
637
638 -Xss1m
639 -Xss1024k
640 -Xss1048576
641
642 This option is equivalent to -XX:ThreadStackSize.
643
644 -Xusealtsigs
645 Use alternative signals instead of SIGUSR1 and SIGUSR2 for JVM
646 internal signals. This option is equivalent to -XX:+UseAltSigs.
647
648 -Xverify:mode
649 Sets the mode of the bytecode verifier. Bytecode verification helps
650 to troubleshoot some problems, but it also adds overhead to the
651 running application. Possible mode arguments for this option
652 include the following:
653
654 none
655 Do not verify the bytecode. This reduces startup time and also
656 reduces the protection provided by Java.
657
658 remote
659 Verify those classes that are not loaded by the bootstrap class
660 loader. This is the default behavior if you do not specify the
661 -Xverify option.
662
663 all
664 Verify all classes.
665
666 Advanced Runtime Options
667 These options control the runtime behavior of the Java HotSpot VM.
668
669 -XX:+DisableAttachMechanism
670 Enables the option that disables the mechanism that lets tools
671 attach to the JVM. By default, this option is disabled, meaning
672 that the attach mechanism is enabled and you can use tools such as
673 jcmd, jstack, jmap, and jinfo.
674
675 -XX:ErrorFile=filename
676 Specifies the path and file name to which error data is written
677 when an irrecoverable error occurs. By default, this file is
678 created in the current working directory and named
679 hs_err_pidpid.log where pid is the identifier of the process that
680 caused the error. The following example shows how to set the
681 default log file (note that the identifier of the process is
682 specified as %p):
683
684 -XX:ErrorFile=./hs_err_pid%p.log
685
686 The following example shows how to set the error log to
687 /var/log/java/java_error.log:
688
689 -XX:ErrorFile=/var/log/java/java_error.log
690
691 If the file cannot be created in the specified directory (due to
692 insufficient space, permission problem, or another issue), then the
693 file is created in the temporary directory for the operating
694 system. The temporary directory is /tmp.
695
696 -XX:+FailOverToOldVerifier
697 Enables automatic failover to the old verifier when the new type
698 checker fails. By default, this option is disabled and it is
699 ignored (that is, treated as disabled) for classes with a recent
700 bytecode version. You can enable it for classes with older versions
701 of the bytecode.
702
703 -XX:LargePageSizeInBytes=size
704 On Solaris, sets the maximum size (in bytes) for large pages used
705 for Java heap. The size argument must be a power of 2 (2, 4, 8, 16,
706 ...). Append the letter k or K to indicate kilobytes, m or M to
707 indicate megabytes, g or G to indicate gigabytes. By default, the
708 size is set to 0, meaning that the JVM chooses the size for large
709 pages automatically.
710
711 The following example illustrates how to set the large page size to
712 4 megabytes (MB):
713
714 -XX:LargePageSizeInBytes=4m
715
716
717 -XX:MaxDirectMemorySize=size
718 Sets the maximum total size (in bytes) of the New I/O (the java.nio
719 package) direct-buffer allocations. Append the letter k or K to
720 indicate kilobytes, m or M to indicate megabytes, g or G to
721 indicate gigabytes. By default, the size is set to 0, meaning that
722 the JVM chooses the size for NIO direct-buffer allocations
723 automatically.
724
725 The following examples illustrate how to set the NIO size to 1024
726 KB in different units:
727
728 -XX:MaxDirectMemorySize=1m
729 -XX:MaxDirectMemorySize=1024k
730 -XX:MaxDirectMemorySize=1048576
731
732
733 -XX:NativeMemoryTracking=mode
734 Specifies the mode for tracking JVM native memory usage. Possible
735 mode arguments for this option include the following:
736
737 off
738 Do not track JVM native memory usage. This is the default
739 behavior if you do not specify the -XX:NativeMemoryTracking
740 option.
741
742 summary
743 Only track memory usage by JVM subsystems, such as Java heap,
744 class, code, and thread.
745
746 detail
747 In addition to tracking memory usage by JVM subsystems, track
748 memory usage by individual CallSite, individual virtual memory
749 region and its committed regions.
750
751 -XX:ObjectAlignmentInBytes=alignment
752 Sets the memory alignment of Java objects (in bytes). By default,
753 the value is set to 8 bytes. The specified value should be a power
754 of two, and must be within the range of 8 and 256 (inclusive). This
755 option makes it possible to use compressed pointers with large Java
756 heap sizes.
757
758 The heap size limit in bytes is calculated as:
759
760 4GB * ObjectAlignmentInBytes
761
762 Note: As the alignment value increases, the unused space between
763 objects will also increase. As a result, you may not realize any
764 benefits from using compressed pointers with large Java heap sizes.
765
766 -XX:OnError=string
767 Sets a custom command or a series of semicolon-separated commands
768 to run when an irrecoverable error occurs. If the string contains
769 spaces, then it must be enclosed in quotation marks.
770
771 The following example shows how the -XX:OnError option can be used
772 to run the gcore command to create the core image, and the debugger
773 is started to attach to the process in case of an irrecoverable
774 error (the %p designates the current process):
775
776 -XX:OnError="gcore %p;dbx - %p"
777
778
779 -XX:OnOutOfMemoryError=string
780 Sets a custom command or a series of semicolon-separated commands
781 to run when an OutOfMemoryError exception is first thrown. If the
782 string contains spaces, then it must be enclosed in quotation
783 marks. For an example of a command string, see the description of
784 the -XX:OnError option.
785
786 -XX:+PerfDataSaveToFile
787 If enabled, saves jstat(1) binary data when the Java application
788 exits. This binary data is saved in a file named hsperfdata_<pid>,
789 where <pid> is the process identifier of the Java application you
790 ran. Use jstat to display the performance data contained in this
791 file as follows:
792
793 jstat -class file:///<path>/hsperfdata_<pid>
794 jstat -gc file:///<path>/hsperfdata_<pid>
795
796 -XX:+PrintCommandLineFlags
797 Enables printing of ergonomically selected JVM flags that appeared
798 on the command line. It can be useful to know the ergonomic values
799 set by the JVM, such as the heap space size and the selected
800 garbage collector. By default, this option is disabled and flags
801 are not printed.
802
803 -XX:+PrintNMTStatistics
804 Enables printing of collected native memory tracking data at JVM
805 exit when native memory tracking is enabled (see
806 -XX:NativeMemoryTracking). By default, this option is disabled and
807 native memory tracking data is not printed.
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:AllocateInstancePrefetchLines=lines
940 Sets the number of lines to prefetch ahead of the instance
941 allocation pointer. By default, the number of lines to prefetch is
942 set to 1:
943
944 -XX:AllocateInstancePrefetchLines=1
945
946 Only the Java HotSpot Server VM supports this option.
947
948 -XX:AllocatePrefetchDistance=size
949 Sets the size (in bytes) of the prefetch distance for object
950 allocation. Memory about to be written with the value of new
951 objects is prefetched up to this distance starting from the address
952 of the last allocated object. Each Java thread has its own
953 allocation point.
954
955 Negative values denote that prefetch distance is chosen based on
956 the platform. Positive values are bytes to prefetch. Append the
957 letter k or K to indicate kilobytes, m or M to indicate megabytes,
958 g or G to indicate gigabytes. The default value is set to -1.
959
960 The following example shows how to set the prefetch distance to
961 1024 bytes:
962
963 -XX:AllocatePrefetchDistance=1024
964
965 Only the Java HotSpot Server VM supports this option.
966
967 -XX:AllocatePrefetchInstr=instruction
968 Sets the prefetch instruction to prefetch ahead of the allocation
969 pointer. Only the Java HotSpot Server VM supports this option.
970 Possible values are from 0 to 3. The actual instructions behind the
971 values depend on the platform. By default, the prefetch instruction
972 is set to 0:
973
974 -XX:AllocatePrefetchInstr=0
975
976 Only the Java HotSpot Server VM supports this option.
977
978 -XX:AllocatePrefetchLines=lines
979 Sets the number of cache lines to load after the last object
980 allocation by using the prefetch instructions generated in compiled
981 code. The default value is 1 if the last allocated object was an
982 instance, and 3 if it was an array.
983
984 The following example shows how to set the number of loaded cache
985 lines to 5:
986
987 -XX:AllocatePrefetchLines=5
988
989 Only the Java HotSpot Server VM supports this option.
990
991 -XX:AllocatePrefetchStepSize=size
992 Sets the step size (in bytes) for sequential prefetch instructions.
993 Append the letter k or K to indicate kilobytes, m or M to indicate
994 megabytes, g or G to indicate gigabytes. By default, the step size
995 is set to 16 bytes:
996
997 -XX:AllocatePrefetchStepSize=16
998
999 Only the Java HotSpot Server VM supports this option.
1000
1001 -XX:AllocatePrefetchStyle=style
1002 Sets the generated code style for prefetch instructions. The style
1003 argument is an integer from 0 to 3:
1004
1005 0
1006 Do not generate prefetch instructions.
1007
1008 1
1009 Execute prefetch instructions after each allocation. This is
1010 the default parameter.
1011
1012 2
1013 Use the thread-local allocation block (TLAB) watermark pointer
1014 to determine when prefetch instructions are executed.
1015
1016 3
1017 Use BIS instruction on SPARC for allocation prefetch.
1018
1019 Only the Java HotSpot Server VM supports this option.
1020
1021 -XX:+BackgroundCompilation
1022 Enables background compilation. This option is enabled by default.
1023 To disable background compilation, specify
1024 -XX:-BackgroundCompilation (this is equivalent to specifying
1025 -Xbatch).
1026
1027 -XX:CICompilerCount=threads
1028 Sets the number of compiler threads to use for compilation. By
1029 default, the number of threads is set to 2 for the server JVM, to 1
1030 for the client JVM, and it scales to the number of cores if tiered
1031 compilation is used. The following example shows how to set the
1032 number of threads to 2:
1033
1034 -XX:CICompilerCount=2
1035
1036
1037 -XX:CodeCacheMinimumFreeSpace=size
1038 Sets the minimum free space (in bytes) required for compilation.
1039 Append the letter k or K to indicate kilobytes, m or M to indicate
1040 megabytes, g or G to indicate gigabytes. When less than the minimum
1041 free space remains, compiling stops. By default, this option is set
1042 to 500 KB. The following example shows how to set the minimum free
1043 space to 1024 MB:
1044
1045 -XX:CodeCacheMinimumFreeSpace=1024m
1046
1047
1048 -XX:CompileCommand=command,method[,option]
1049 Specifies a command to perform on a method. For example, to exclude
1050 the indexOf() method of the String class from being compiled, use
1051 the following:
1052
1053 -XX:CompileCommand=exclude,java/lang/String.indexOf
1054
1055 Note that the full class name is specified, including all packages
1056 and subpackages separated by a slash (/). For easier cut and paste
1057 operations, it is also possible to use the method name format
1058 produced by the -XX:+PrintCompilation and -XX:+LogCompilation
1059 options:
1060
1061 -XX:CompileCommand=exclude,java.lang.String::indexOf
1062
1063 If the method is specified without the signature, the command will
1064 be applied to all methods with the specified name. However, you can
1065 also specify the signature of the method in the class file format.
1066 In this case, you should enclose the arguments in quotation marks,
1067 because otherwise the shell treats the semicolon as command end.
1068 For example, if you want to exclude only the indexOf(String) method
1069 of the String class from being compiled, use the following:
1070
1071 -XX:CompileCommand="exclude,java/lang/String.indexOf,(Ljava/lang/String;)I"
1072
1073 You can also use the asterisk (*) as a wildcard for class and
1074 method names. For example, to exclude all indexOf() methods in all
1075 classes from being compiled, use the following:
1076
1077 -XX:CompileCommand=exclude,*.indexOf
1078
1079 The commas and periods are aliases for spaces, making it easier to
1080 pass compiler commands through a shell. You can pass arguments to
1081 -XX:CompileCommand using spaces as separators by enclosing the
1082 argument in quotation marks:
1083
1084 -XX:CompileCommand="exclude java/lang/String indexOf"
1085
1086 Note that after parsing the commands passed on the command line
1087 using the -XX:CompileCommand options, the JIT compiler then reads
1088 commands from the .hotspot_compiler file. You can add commands to
1089 this file or specify a different file using the
1090 -XX:CompileCommandFile option.
1091
1092 To add several commands, either specify the -XX:CompileCommand
1093 option multiple times, or separate each argument with the newline
1094 separator (\n). The following commands are available:
1095
1096 break
1097 Set a breakpoint when debugging the JVM to stop at the
1098 beginning of compilation of the specified method.
1099
1100 compileonly
1101 Exclude all methods from compilation except for the specified
1102 method. As an alternative, you can use the -XX:CompileOnly
1103 option, which allows to specify several methods.
1104
1105 dontinline
1106 Prevent inlining of the specified method.
1107
1108 exclude
1109 Exclude the specified method from compilation.
1110
1111 help
1112 Print a help message for the -XX:CompileCommand option.
1113
1114 inline
1115 Attempt to inline the specified method.
1116
1117 log
1118 Exclude compilation logging (with the -XX:+LogCompilation
1119 option) for all methods except for the specified method. By
1120 default, logging is performed for all compiled methods.
1121
1122 option
1123 This command can be used to pass a JIT compilation option to
1124 the specified method in place of the last argument (option).
1125 The compilation option is set at the end, after the method
1126 name. For example, to enable the BlockLayoutByFrequency option
1127 for the append() method of the StringBuffer class, use the
1128 following:
1129
1130 -XX:CompileCommand=option,java/lang/StringBuffer.append,BlockLayoutByFrequency
1131
1132 You can specify multiple compilation options, separated by
1133 commas or spaces.
1134
1135 print
1136 Print generated assembler code after compilation of the
1137 specified method.
1138
1139 quiet
1140 Do not print the compile commands. By default, the commands
1141 that you specify with the -XX:CompileCommand option are
1142 printed; for example, if you exclude from compilation the
1143 indexOf() method of the String class, then the following will
1144 be printed to standard output:
1145
1146 CompilerOracle: exclude java/lang/String.indexOf
1147
1148 You can suppress this by specifying the
1149 -XX:CompileCommand=quiet option before other -XX:CompileCommand
1150 options.
1151
1152 -XX:CompileCommandFile=filename
1153 Sets the file from which JIT compiler commands are read. By
1154 default, the .hotspot_compiler file is used to store commands
1155 performed by the JIT compiler.
1156
1157 Each line in the command file represents a command, a class name,
1158 and a method name for which the command is used. For example, this
1159 line prints assembly code for the toString() method of the String
1160 class:
1161
1162 print java/lang/String toString
1163
1164 For more information about specifying the commands for the JIT
1165 compiler to perform on methods, see the -XX:CompileCommand option.
1166
1167 -XX:CompileOnly=methods
1168 Sets the list of methods (separated by commas) to which compilation
1169 should be restricted. Only the specified methods will be compiled.
1170 Specify each method with the full class name (including the
1171 packages and subpackages). For example, to compile only the
1172 length() method of the String class and the size() method of the
1173 List class, use the following:
1174
1175 -XX:CompileOnly=java/lang/String.length,java/util/List.size
1176
1177 Note that the full class name is specified, including all packages
1178 and subpackages separated by a slash (/). For easier cut and paste
1179 operations, it is also possible to use the method name format
1180 produced by the -XX:+PrintCompilation and -XX:+LogCompilation
1181 options:
1182
1183 -XX:CompileOnly=java.lang.String::length,java.util.List::size
1184
1185 Although wildcards are not supported, you can specify only the
1186 class or package name to compile all methods in that class or
1187 package, as well as specify just the method to compile methods with
1188 this name in any class:
1189
1190 -XX:CompileOnly=java/lang/String
1191 -XX:CompileOnly=java/lang
1192 -XX:CompileOnly=.length
1193
1194
1195 -XX:CompileThreshold=invocations
1196 Sets the number of interpreted method invocations before
1197 compilation. By default, in the server JVM, the JIT compiler
1198 performs 10,000 interpreted method invocations to gather
1199 information for efficient compilation. For the client JVM, the
1200 default setting is 1,500 invocations. This option is ignored when
1201 tiered compilation is enabled; see the option
1202 -XX:+TieredCompilation. The following example shows how to set the
1203 number of interpreted method invocations to 5,000:
1204
1205 -XX:CompileThreshold=5000
1206
1207 You can completely disable interpretation of Java methods before
1208 compilation by specifying the -Xcomp option.
1209
1210 -XX:+DoEscapeAnalysis
1211 Enables the use of escape analysis. This option is enabled by
1212 default. To disable the use of escape analysis, specify
1213 -XX:-DoEscapeAnalysis. Only the Java HotSpot Server VM supports
1214 this option.
1215
1216 -XX:InitialCodeCacheSize=size
1217 Sets the initial code cache size (in bytes). Append the letter k or
1218 K to indicate kilobytes, m or M to indicate megabytes, g or G to
1219 indicate gigabytes. The default value is set to 500 KB. The initial
1220 code cache size should be not less than the system's minimal memory
1221 page size. The following example shows how to set the initial code
1222 cache size to 32 KB:
1223
1224 -XX:InitialCodeCacheSize=32k
1225
1226
1227 -XX:+Inline
1228 Enables method inlining. This option is enabled by default to
1229 increase performance. To disable method inlining, specify
1230 -XX:-Inline.
1231
1232 -XX:InlineSmallCode=size
1233 Sets the maximum code size (in bytes) for compiled methods that
1234 should be inlined. Append the letter k or K to indicate kilobytes,
1235 m or M to indicate megabytes, g or G to indicate gigabytes. Only
1236 compiled methods with the size smaller than the specified size will
1237 be inlined. By default, the maximum code size is set to 1000 bytes:
1238
1239 -XX:InlineSmallCode=1000
1240
1241
1242 -XX:+LogCompilation
1243 Enables logging of compilation activity to a file named hotspot.log
1244 in the current working directory. You can specify a different log
1245 file path and name using the -XX:LogFile option.
1246
1247 By default, this option is disabled and compilation activity is not
1248 logged. The -XX:+LogCompilation option has to be used together with
1249 the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic
1250 JVM options.
1251
1252 You can enable verbose diagnostic output with a message printed to
1253 the console every time a method is compiled by using the
1254 -XX:+PrintCompilation option.
1255
1256 -XX:MaxInlineSize=size
1257 Sets the maximum bytecode size (in bytes) of a method to be
1258 inlined. Append the letter k or K to indicate kilobytes, m or M to
1259 indicate megabytes, g or G to indicate gigabytes. By default, the
1260 maximum bytecode size is set to 35 bytes:
1261
1262 -XX:MaxInlineSize=35
1263
1264
1265 -XX:MaxNodeLimit=nodes
1266 Sets the maximum number of nodes to be used during single method
1267 compilation. By default, the maximum number of nodes is set to
1268 65,000:
1269
1270 -XX:MaxNodeLimit=65000
1271
1272
1273 -XX:MaxTrivialSize=size
1274 Sets the maximum bytecode size (in bytes) of a trivial method to be
1275 inlined. Append the letter k or K to indicate kilobytes, m or M to
1276 indicate megabytes, g or G to indicate gigabytes. By default, the
1277 maximum bytecode size of a trivial method is set to 6 bytes:
1278
1279 -XX:MaxTrivialSize=6
1280
1281
1282 -XX:+OptimizeStringConcat
1283 Enables the optimization of String concatenation operations. This
1284 option is enabled by default. To disable the optimization of String
1285 concatenation operations, specify -XX:-OptimizeStringConcat. Only
1286 the Java HotSpot Server VM supports this option.
1287
1288 -XX:+PrintAssembly
1289 Enables printing of assembly code for bytecoded and native methods
1290 by using the external disassembler.so library. This enables you to
1291 see the generated code, which may help you to diagnose performance
1292 issues.
1293
1294 By default, this option is disabled and assembly code is not
1295 printed. The -XX:+PrintAssembly option has to be used together with
1296 the -XX:UnlockDiagnosticVMOptions option that unlocks diagnostic
1297 JVM options.
1298
1299 -XX:+PrintCompilation
1300 Enables verbose diagnostic output from the JVM by printing a
1301 message to the console every time a method is compiled. This
1302 enables you to see which methods actually get compiled. By default,
1303 this option is disabled and diagnostic output is not printed.
1304
1305 You can also log compilation activity to a file by using the
1306 -XX:+LogCompilation option.
1307
1308 -XX:+PrintInlining
1309 Enables printing of inlining decisions. This enables you to see
1310 which methods are getting inlined.
1311
1312 By default, this option is disabled and inlining information is not
1313 printed. The -XX:+PrintInlining option has to be used together with
1314 the -XX:+UnlockDiagnosticVMOptions option that unlocks diagnostic
1315 JVM options.
1316
1317 -XX:ReservedCodeCacheSize=size
1318 Sets the maximum code cache size (in bytes) for JIT-compiled code.
1319 Append the letter k or K to indicate kilobytes, m or M to indicate
1320 megabytes, g or G to indicate gigabytes. The default maximum code
1321 cache size is 240 MB; if you disable tiered compilation with the
1322 option -XX:-TieredCompilation, then the default size is 48 MB. This
1323 option has a limit of 2 GB; otherwise, an error is generated. The
1324 maximum code cache size should not be less than the initial code
1325 cache size; see the option -XX:InitialCodeCacheSize. This option is
1326 equivalent to -Xmaxjitcodesize.
1327
1328 -XX:RTMAbortRatio=abort_ratio
1329 The RTM abort ratio is specified as a percentage (%) of all
1330 executed RTM transactions. If a number of aborted transactions
1331 becomes greater than this ratio, then the compiled code will be
1332 deoptimized. This ratio is used when the -XX:+UseRTMDeopt option is
1333 enabled. The default value of this option is 50. This means that
1334 the compiled code will be deoptimized if 50% of all transactions
1335 are aborted.
1336
1337 -XX:RTMRetryCount=number_of_retries
1338 RTM locking code will be retried, when it is aborted or busy, the
1339 number of times specified by this option before falling back to the
1340 normal locking mechanism. The default value for this option is 5.
1341 The -XX:UseRTMLocking option must be enabled.
1342
1343 -XX:-TieredCompilation
1344 Disables the use of tiered compilation. By default, this option is
1345 enabled. Only the Java HotSpot Server VM supports this option.
1346
1347 -XX:+UseAES
1348 Enables hardware-based AES intrinsics for Intel, AMD, and SPARC
1349 hardware. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and
1350 newer), and SPARC (T4 and newer) are the supported hardware. UseAES
1351 is used in conjunction with UseAESIntrinsics.
1352
1353 -XX:+UseAESIntrinsics
1354 UseAES and UseAESIntrinsics flags are enabled by default and are
1355 supported only for Java HotSpot Server VM 32-bit and 64-bit. To
1356 disable hardware-based AES intrinsics, specify -XX:-UseAES
1357 -XX:-UseAESIntrinsics. For example, to enable hardware AES, use the
1358 following flags:
1359
1360 -XX:+UseAES -XX:+UseAESIntrinsics
1361
1362 To support UseAES and UseAESIntrinsics flags for 32-bit and 64-bit
1363 use -server option to choose Java HotSpot Server VM. These flags
1364 are not supported on Client VM.
1365
1366 -XX:+UseCodeCacheFlushing
1367 Enables flushing of the code cache before shutting down the
1368 compiler. This option is enabled by default. To disable flushing of
1369 the code cache before shutting down the compiler, specify
1370 -XX:-UseCodeCacheFlushing.
1371
1372 -XX:+UseCondCardMark
1373 Enables checking of whether the card is already marked before
1374 updating the card table. This option is disabled by default and
1375 should only be used on machines with multiple sockets, where it
1376 will increase performance of Java applications that rely heavily on
1377 concurrent operations. Only the Java HotSpot Server VM supports
1378 this option.
1379
1380 -XX:+UseRTMDeopt
1381 Auto-tunes RTM locking depending on the abort ratio. This ratio is
1382 specified by -XX:RTMAbortRatio option. If the number of aborted
1383 transactions exceeds the abort ratio, then the method containing
1384 the lock will be deoptimized and recompiled with all locks as
1385 normal locks. This option is disabled by default. The
1386 -XX:+UseRTMLocking option must be enabled.
1387
1388 -XX:+UseRTMLocking
1389 Generate Restricted Transactional Memory (RTM) locking code for all
1390 inflated locks, with the normal locking mechanism as the fallback
1391 handler. This option is disabled by default. Options related to RTM
1392 are only available for the Java HotSpot Server VM on x86 CPUs that
1393 support Transactional Synchronization Extensions (TSX).
1394
1395 RTM is part of Intel's TSX, which is an x86 instruction set
1396 extension and facilitates the creation of multithreaded
1397 applications. RTM introduces the new instructions XBEGIN, XABORT,
1398 XEND, and XTEST. The XBEGIN and XEND instructions enclose a set of
1399 instructions to run as a transaction. If no conflict is found when
1400 running the transaction, the memory and register modifications are
1401 committed together at the XEND instruction. The XABORT instruction
1402 can be used to explicitly abort a transaction and the XEND
1403 instruction to check if a set of instructions are being run in a
1404 transaction.
1405
1406 A lock on a transaction is inflated when another thread tries to
1407 access the same transaction, thereby blocking the thread that did
1408 not originally request access to the transaction. RTM requires that
1409 a fallback set of operations be specified in case a transaction
1410 aborts or fails. An RTM lock is a lock that has been delegated to
1411 the TSX's system.
1412
1413 RTM improves performance for highly contended locks with low
1414 conflict in a critical region (which is code that must not be
1415 accessed by more than one thread concurrently). RTM also improves
1416 the performance of coarse-grain locking, which typically does not
1417 perform well in multithreaded applications. (Coarse-grain locking
1418 is the strategy of holding locks for long periods to minimize the
1419 overhead of taking and releasing locks, while fine-grained locking
1420 is the strategy of trying to achieve maximum parallelism by locking
1421 only when necessary and unlocking as soon as possible.) Also, for
1422 lightly contended locks that are used by different threads, RTM can
1423 reduce false cache line sharing, also known as cache line
1424 ping-pong. This occurs when multiple threads from different
1425 processors are accessing different resources, but the resources
1426 share the same cache line. As a result, the processors repeatedly
1427 invalidate the cache lines of other processors, which forces them
1428 to read from main memory instead of their cache.
1429
1430 -XX:+UseSHA
1431 Enables hardware-based intrinsics for SHA crypto hash functions for
1432 SPARC hardware. UseSHA is used in conjunction with the
1433 UseSHA1Intrinsics, UseSHA256Intrinsics, and UseSHA512Intrinsics
1434 options.
1435
1436 The UseSHA and UseSHA*Intrinsics flags are enabled by default, and
1437 are supported only for Java HotSpot Server VM 64-bit on SPARC T4
1438 and newer.
1439
1440 This feature is only applicable when using the
1441 sun.security.provider.Sun provider for SHA operations.
1442
1443 To disable all hardware-based SHA intrinsics, specify -XX:-UseSHA.
1444 To disable only a particular SHA intrinsic, use the appropriate
1445 corresponding option. For example: -XX:-UseSHA256Intrinsics.
1446
1447 -XX:+UseSHA1Intrinsics
1448 Enables intrinsics for SHA-1 crypto hash function.
1449
1450 -XX:+UseSHA256Intrinsics
1451 Enables intrinsics for SHA-224 and SHA-256 crypto hash functions.
1452
1453 -XX:+UseSHA512Intrinsics
1454 Enables intrinsics for SHA-384 and SHA-512 crypto hash functions.
1455
1456 -XX:+UseSuperWord
1457 Enables the transformation of scalar operations into superword
1458 operations. This option is enabled by default. To disable the
1459 transformation of scalar operations into superword operations,
1460 specify -XX:-UseSuperWord. Only the Java HotSpot Server VM supports
1461 this option.
1462
1463 Advanced Serviceability Options
1464 These options provide the ability to gather system information and
1465 perform extensive debugging.
1466
1467 -XX:+ExtendedDTraceProbes
1468 Enables additional dtrace tool probes that impact the performance.
1469 By default, this option is disabled and dtrace performs only
1470 standard probes.
1471
1472 -XX:+HeapDumpOnOutOfMemory
1473 Enables the dumping of the Java heap to a file in the current
1474 directory by using the heap profiler (HPROF) when a
1475 java.lang.OutOfMemoryError exception is thrown. You can explicitly
1476 set the heap dump file path and name using the -XX:HeapDumpPath
1477 option. By default, this option is disabled and the heap is not
1478 dumped when an OutOfMemoryError exception is thrown.
1479
1480 -XX:HeapDumpPath=path
1481 Sets the path and file name for writing the heap dump provided by
1482 the heap profiler (HPROF) when the -XX:+HeapDumpOnOutOfMemoryError
1483 option is set. By default, the file is created in the current
1484 working directory, and it is named java_pidpid.hprof where pid is
1485 the identifier of the process that caused the error. The following
1486 example shows how to set the default file explicitly (%p represents
1487 the current process identificator):
1488
1489 -XX:HeapDumpPath=./java_pid%p.hprof
1490
1491 The following example shows how to set the heap dump file to
1492 /var/log/java/java_heapdump.hprof:
1493
1494 -XX:HeapDumpPath=/var/log/java/java_heapdump.hprof
1495
1496
1497 -XX:LogFile=path
1498 Sets the path and file name where log data is written. By default,
1499 the file is created in the current working directory, and it is
1500 named hotspot.log.
1501
1502 The following example shows how to set the log file to
1503 /var/log/java/hotspot.log:
1504
1505 -XX:LogFile=/var/log/java/hotspot.log
1506
1507
1508 -XX:+PrintClassHistogram
1509 Enables printing of a class instance histogram after a Control+C
1510 event (SIGTERM). By default, this option is disabled.
1511
1512 Setting this option is equivalent to running the jmap -histo
1513 command, or the jcmd pid GC.class_histogram command, where pid is
1514 the current Java process identifier.
1515
1516 -XX:+PrintConcurrentLocks
1517 Enables printing of locks after a event. By default, this option is
1518 disabled.
1519
1520 Enables printing of java.util.concurrent locks after a Control+C
1521 event (SIGTERM). By default, this option is disabled.
1522
1523 Setting this option is equivalent to running the jstack -l command
1524 or the jcmd pid Thread.print -l command, where pid is the current
1525 Java process identifier.
1526
1527 -XX:+UnlockDiagnosticVMOptions
1528 Unlocks the options intended for diagnosing the JVM. By default,
1529 this option is disabled and diagnostic options are not available.
1530
1531 Advanced Garbage Collection Options
1532 These options control how garbage collection (GC) is performed by the
1533 Java HotSpot VM.
1534
1535 -XX:+AggressiveHeap
1536 Enables Java heap optimization. This sets various parameters to be
1537 optimal for long-running jobs with intensive memory allocation,
1538 based on the configuration of the computer (RAM and CPU). By
1539 default, the option is disabled and the heap is not optimized.
1540
1541 -XX:+AlwaysPreTouch
1542 Enables touching of every page on the Java heap during JVM
1543 initialization. This gets all pages into the memory before entering
1544 the main() method. The option can be used in testing to simulate a
1545 long-running system with all virtual memory mapped to physical
1546 memory. By default, this option is disabled and all pages are
1547 committed as JVM heap space fills.
1548
1549 -XX:+CMSClassUnloadingEnabled
1550 Enables class unloading when using the concurrent mark-sweep (CMS)
1551 garbage collector. This option is enabled by default. To disable
1552 class unloading for the CMS garbage collector, specify
1553 -XX:-CMSClassUnloadingEnabled.
1554
1555 -XX:CMSExpAvgFactor=percent
1556 Sets the percentage of time (0 to 100) used to weight the current
1557 sample when computing exponential averages for the concurrent
1558 collection statistics. By default, the exponential averages factor
1559 is set to 25%. The following example shows how to set the factor to
1560 15%:
1561
1562 -XX:CMSExpAvgFactor=15
1563
1564
1565 -XX:CMSInitiatingOccupancyFraction=percent
1566 Sets the percentage of the old generation occupancy (0 to 100) at
1567 which to start a CMS collection cycle. The default value is set to
1568 -1. Any negative value (including the default) implies that
1569 -XX:CMSTriggerRatio is used to define the value of the initiating
1570 occupancy fraction.
1571
1572 The following example shows how to set the occupancy fraction to
1573 20%:
1574
1575 -XX:CMSInitiatingOccupancyFraction=20
1576
1577
1578 -XX:+CMSScavengeBeforeRemark
1579 Enables scavenging attempts before the CMS remark step. By default,
1580 this option is disabled.
1581
1582 -XX:CMSTriggerRatio=percent
1583 Sets the percentage (0 to 100) of the value specified by
1584 -XX:MinHeapFreeRatio that is allocated before a CMS collection
1585 cycle commences. The default value is set to 80%.
1586
1587 The following example shows how to set the occupancy fraction to
1588 75%:
1589
1590 -XX:CMSTriggerRatio=75
1591
1592
1593 -XX:ConcGCThreads=threads
1594 Sets the number of threads used for concurrent GC. The default
1595 value depends on the number of CPUs available to the JVM.
1596
1597 For example, to set the number of threads for concurrent GC to 2,
1598 specify the following option:
1599
1600 -XX:ConcGCThreads=2
1601
1602
1603 -XX:+DisableExplicitGC
1604 Enables the option that disables processing of calls to
1605 System.gc(). This option is disabled by default, meaning that calls
1606 to System.gc() are processed. If processing of calls to System.gc()
1607 is disabled, the JVM still performs GC when necessary.
1608
1609 -XX:+ExplicitGCInvokesConcurrent
1610 Enables invoking of concurrent GC by using the System.gc() request.
1611 This option is disabled by default and can be enabled only together
1612 with the -XX:+UseConcMarkSweepGC option.
1613
1614 -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
1615 Enables invoking of concurrent GC by using the System.gc() request
1616 and unloading of classes during the concurrent GC cycle. This
1617 option is disabled by default and can be enabled only together with
1618 the -XX:+UseConcMarkSweepGC option.
1619
1620 -XX:G1HeapRegionSize=size
1621 Sets the size of the regions into which the Java heap is subdivided
1622 when using the garbage-first (G1) collector. The value can be
1623 between 1 MB and 32 MB. The default region size is determined
1624 ergonomically based on the heap size.
1625
1626 The following example shows how to set the size of the subdivisions
1627 to 16 MB:
1628
1629 -XX:G1HeapRegionSize=16m
1630
1631
1632 -XX:+G1PrintHeapRegions
1633 Enables the printing of information about which regions are
1634 allocated and which are reclaimed by the G1 collector. By default,
1635 this option is disabled.
1636
1637 -XX:G1ReservePercent=percent
1638 Sets the percentage of the heap (0 to 50) that is reserved as a
1639 false ceiling to reduce the possibility of promotion failure for
1640 the G1 collector. By default, this option is set to 10%.
1641
1642 The following example shows how to set the reserved heap to 20%:
1643
1644 -XX:G1ReservePercent=20
1645
1646
1647 -XX:InitialHeapSize=size
1648 Sets the initial size (in bytes) of the memory allocation pool.
1649 This value must be either 0, or a multiple of 1024 and greater than
1650 1 MB. Append the letter k or K to indicate kilobytes, m or M to
1651 indicate megabytes, g or G to indicate gigabytes. The default value
1652 is chosen at runtime based on system configuration. See the section
1653 "Ergonomics" in Java SE HotSpot Virtual Machine Garbage Collection
1654 Tuning Guide at
1655 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.
1656
1657 The following examples show how to set the size of allocated memory
1658 to 6 MB using various units:
1659
1660 -XX:InitialHeapSize=6291456
1661 -XX:InitialHeapSize=6144k
1662 -XX:InitialHeapSize=6m
1663
1664 If you set this option to 0, then the initial size will be set as
1665 the sum of the sizes allocated for the old generation and the young
1666 generation. The size of the heap for the young generation can be
1667 set using the -XX:NewSize option.
1668
1669 -XX:InitialSurvivorRatio=ratio
1670 Sets the initial survivor space ratio used by the throughput
1671 garbage collector (which is enabled by the -XX:+UseParallelGC
1672 and/or -XX:+UseParallelOldGC options). Adaptive sizing is enabled
1673 by default with the throughput garbage collector by using the
1674 -XX:+UseParallelGC and -XX:+UseParallelOldGC options, and survivor
1675 space is resized according to the application behavior, starting
1676 with the initial value. If adaptive sizing is disabled (using the
1677 -XX:-UseAdaptiveSizePolicy option), then the -XX:SurvivorRatio
1678 option should be used to set the size of the survivor space for the
1679 entire execution of the application.
1680
1681 The following formula can be used to calculate the initial size of
1682 survivor space (S) based on the size of the young generation (Y),
1683 and the initial survivor space ratio (R):
1684
1685 S=Y/(R+2)
1686
1687 The 2 in the equation denotes two survivor spaces. The larger the
1688 value specified as the initial survivor space ratio, the smaller
1689 the initial survivor space size.
1690
1691 By default, the initial survivor space ratio is set to 8. If the
1692 default value for the young generation space size is used (2 MB),
1693 the initial size of the survivor space will be 0.2 MB.
1694
1695 The following example shows how to set the initial survivor space
1696 ratio to 4:
1697
1698 -XX:InitialSurvivorRatio=4
1699
1700
1701 -XX:InitiatingHeapOccupancyPercent=percent
1702 Sets the percentage of the heap occupancy (0 to 100) at which to
1703 start a concurrent GC cycle. It is used by garbage collectors that
1704 trigger a concurrent GC cycle based on the occupancy of the entire
1705 heap, not just one of the generations (for example, the G1 garbage
1706 collector).
1707
1708 By default, the initiating value is set to 45%. A value of 0
1709 implies nonstop GC cycles. The following example shows how to set
1710 the initiating heap occupancy to 75%:
1711
1712 -XX:InitiatingHeapOccupancyPercent=75
1713
1714
1715 -XX:MaxGCPauseMillis=time
1716 Sets a target for the maximum GC pause time (in milliseconds). This
1717 is a soft goal, and the JVM will make its best effort to achieve
1718 it. By default, there is no maximum pause time value.
1719
1720 The following example shows how to set the maximum target pause
1721 time to 500 ms:
1722
1723 -XX:MaxGCPauseMillis=500
1724
1725
1726 -XX:MaxHeapSize=size
1727 Sets the maximum size (in byes) of the memory allocation pool. This
1728 value must be a multiple of 1024 and greater than 2 MB. Append the
1729 letter k or K to indicate kilobytes, m or M to indicate megabytes,
1730 g or G to indicate gigabytes. The default value is chosen at
1731 runtime based on system configuration. For server deployments,
1732 -XX:InitialHeapSize and -XX:MaxHeapSize are often set to the same
1733 value. See the section "Ergonomics" in Java SE HotSpot Virtual
1734 Machine Garbage Collection Tuning Guide at
1735 http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html.
1736
1737 The following examples show how to set the maximum allowed size of
1738 allocated memory to 80 MB using various units:
1739
1740 -XX:MaxHeapSize=83886080
1741 -XX:MaxHeapSize=81920k
1742 -XX:MaxHeapSize=80m
1743
1744 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper
1745 limit for this value is approximately 4,000 MB minus overhead
1746 amounts. On Oracle Solaris 2.6 and x86 platforms, the upper limit
1747 is approximately 2,000 MB minus overhead amounts. On Linux
1748 platforms, the upper limit is approximately 2,000 MB minus overhead
1749 amounts.
1750
1751 The -XX:MaxHeapSize option is equivalent to -Xmx.
1752
1753 -XX:MaxHeapFreeRatio=percent
1754 Sets the maximum allowed percentage of free heap space (0 to 100)
1755 after a GC event. If free heap space expands above this value, then
1756 the heap will be shrunk. By default, this value is set to 70%.
1757
1758 The following example shows how to set the maximum free heap ratio
1759 to 75%:
1760
1761 -XX:MaxHeapFreeRatio=75
1762
1763
1764 -XX:MaxMetaspaceSize=size
1765 Sets the maximum amount of native memory that can be allocated for
1766 class metadata. By default, the size is not limited. The amount of
1767 metadata for an application depends on the application itself,
1768 other running applications, and the amount of memory available on
1769 the system.
1770
1771 The following example shows how to set the maximum class metadata
1772 size to 256 MB:
1773
1774 -XX:MaxMetaspaceSize=256m
1775
1776
1777 -XX:MaxNewSize=size
1778 Sets the maximum size (in bytes) of the heap for the young
1779 generation (nursery). The default value is set ergonomically.
1780
1781 -XX:MaxTenuringThreshold=threshold
1782 Sets the maximum tenuring threshold for use in adaptive GC sizing.
1783 The largest value is 15. The default value is 15 for the parallel
1784 (throughput) collector, and 6 for the CMS collector.
1785
1786 The following example shows how to set the maximum tenuring
1787 threshold to 10:
1788
1789 -XX:MaxTenuringThreshold=10
1790
1791
1792 -XX:MetaspaceSize=size
1793 Sets the size of the allocated class metadata space that will
1794 trigger a garbage collection the first time it is exceeded. This
1795 threshold for a garbage collection is increased or decreased
1796 depending on the amount of metadata used. The default size depends
1797 on the platform.
1798
1799 -XX:MinHeapFreeRatio=percent
1800 Sets the minimum allowed percentage of free heap space (0 to 100)
1801 after a GC event. If free heap space falls below this value, then
1802 the heap will be expanded. By default, this value is set to 40%.
1803
1804 The following example shows how to set the minimum free heap ratio
1805 to 25%:
1806
1807 -XX:MinHeapFreeRatio=25
1808
1809
1810 -XX:NewRatio=ratio
1811 Sets the ratio between young and old generation sizes. By default,
1812 this option is set to 2. The following example shows how to set the
1813 young/old ratio to 1:
1814
1815 -XX:NewRatio=1
1816
1817
1818 -XX:NewSize=size
1819 Sets the initial size (in bytes) of the heap for the young
1820 generation (nursery). Append the letter k or K to indicate
1821 kilobytes, m or M to indicate megabytes, g or G to indicate
1822 gigabytes.
1823
1824 The young generation region of the heap is used for new objects. GC
1825 is performed in this region more often than in other regions. If
1826 the size for the young generation is too low, then a large number
1827 of minor GCs will be performed. If the size is too high, then only
1828 full GCs will be performed, which can take a long time to complete.
1829 Oracle recommends that you keep the size for the young generation
1830 between a half and a quarter of the overall heap size.
1831
1832 The following examples show how to set the initial size of young
1833 generation to 256 MB using various units:
1834
1835 -XX:NewSize=256m
1836 -XX:NewSize=262144k
1837 -XX:NewSize=268435456
1838
1839 The -XX:NewSize option is equivalent to -Xmn.
1840
1841 -XX:ParallelGCThreads=threads
1842 Sets the number of threads used for parallel garbage collection in
1843 the young and old generations. The default value depends on the
1844 number of CPUs available to the JVM.
1845
1846 For example, to set the number of threads for parallel GC to 2,
1847 specify the following option:
1848
1849 -XX:ParallelGCThreads=2
1850
1851
1852 -XX:+ParallelRefProcEnabled
1853 Enables parallel reference processing. By default, this option is
1854 disabled.
1855
1856 -XX:+PrintAdaptiveSizePolicy
1857 Enables printing of information about adaptive generation sizing.
1858 By default, this option is disabled.
1859
1860 -XX:+PrintGC
1861 Enables printing of messages at every GC. By default, this option
1862 is disabled.
1863
1864 -XX:+PrintGCApplicationConcurrentTime
1865 Enables printing of how much time elapsed since the last pause (for
1866 example, a GC pause). By default, this option is disabled.
1867
1868 -XX:+PrintGCApplicationStoppedTime
1869 Enables printing of how much time the pause (for example, a GC
1870 pause) lasted. By default, this option is disabled.
1871
1872 -XX:+PrintGCDateStamps
1873 Enables printing of a date stamp at every GC. By default, this
1874 option is disabled.
1875
1876 -XX:+PrintGCDetails
1877 Enables printing of detailed messages at every GC. By default, this
1878 option is disabled.
1879
1880 -XX:+PrintGCTaskTimeStamps
1881 Enables printing of time stamps for every individual GC worker
1882 thread task. By default, this option is disabled.
1883
1884 -XX:+PrintGCTimeStamps
1885 Enables printing of time stamps at every GC. By default, this
1886 option is disabled.
1887
1888 -XX:+PrintStringDeduplicationStatistics
1889 Prints detailed deduplication statistics. By default, this option
1890 is disabled. See the -XX:+UseStringDeduplication option.
1891
1892 -XX:+PrintTenuringDistribution
1893 Enables printing of tenuring age information. The following is an
1894 example of the output:
1895
1896 Desired survivor size 48286924 bytes, new threshold 10 (max 10)
1897 - age 1: 28992024 bytes, 28992024 total
1898 - age 2: 1366864 bytes, 30358888 total
1899 - age 3: 1425912 bytes, 31784800 total
1900 ...
1901
1902 Age 1 objects are the youngest survivors (they were created after
1903 the previous scavenge, survived the latest scavenge, and moved from
1904 eden to survivor space). Age 2 objects have survived two scavenges
1905 (during the second scavenge they were copied from one survivor
1906 space to the next). And so on.
1907
1908 In the preceding example, 28 992 024 bytes survived one scavenge
1909 and were copied from eden to survivor space, 1 366 864 bytes are
1910 occupied by age 2 objects, etc. The third value in each row is the
1911 cumulative size of objects of age n or less.
1912
1913 By default, this option is disabled.
1914
1915 -XX:+ScavengeBeforeFullGC
1916 Enables GC of the young generation before each full GC. This option
1917 is enabled by default. Oracle recommends that you do not disable
1918 it, because scavenging the young generation before a full GC can
1919 reduce the number of objects reachable from the old generation
1920 space into the young generation space. To disable GC of the young
1921 generation before each full GC, specify -XX:-ScavengeBeforeFullGC.
1922
1923 -XX:SoftRefLRUPolicyMSPerMB=time
1924 Sets the amount of time (in milliseconds) a softly reachable object
1925 is kept active on the heap after the last time it was referenced.
1926 The default value is one second of lifetime per free megabyte in
1927 the heap. The -XX:SoftRefLRUPolicyMSPerMB option accepts integer
1928 values representing milliseconds per one megabyte of the current
1929 heap size (for Java HotSpot Client VM) or the maximum possible heap
1930 size (for Java HotSpot Server VM). This difference means that the
1931 Client VM tends to flush soft references rather than grow the heap,
1932 whereas the Server VM tends to grow the heap rather than flush soft
1933 references. In the latter case, the value of the -Xmx option has a
1934 significant effect on how quickly soft references are garbage
1935 collected.
1936
1937 The following example shows how to set the value to 2.5 seconds:
1938
1939 -XX:SoftRefLRUPolicyMSPerMB=2500
1940
1941
1942 -XX:StringDeduplicationAgeThreshold=threshold
1943 String objects reaching the specified age are considered candidates
1944 for deduplication. An object's age is a measure of how many times
1945 it has survived garbage collection. This is sometimes referred to
1946 as tenuring; see the -XX:+PrintTenuringDistribution option. Note
1947 that String objects that are promoted to an old heap region before
1948 this age has been reached are always considered candidates for
1949 deduplication. The default value for this option is 3. See the
1950 -XX:+UseStringDeduplication option.
1951
1952 -XX:SurvivorRatio=ratio
1953 Sets the ratio between eden space size and survivor space size. By
1954 default, this option is set to 8. The following example shows how
1955 to set the eden/survivor space ratio to 4:
1956
1957 -XX:SurvivorRatio=4
1958
1959
1960 -XX:TargetSurvivorRatio=percent
1961 Sets the desired percentage of survivor space (0 to 100) used after
1962 young garbage collection. By default, this option is set to 50%.
1963
1964 The following example shows how to set the target survivor space
1965 ratio to 30%:
1966
1967 -XX:TargetSurvivorRatio=30
1968
1969
1970 -XX:TLABSize=size
1971 Sets the initial size (in bytes) of a thread-local allocation
1972 buffer (TLAB). Append the letter k or K to indicate kilobytes, m or
1973 M to indicate megabytes, g or G to indicate gigabytes. If this
1974 option is set to 0, then the JVM chooses the initial size
1975 automatically.
1976
1977 The following example shows how to set the initial TLAB size to 512
1978 KB:
1979
1980 -XX:TLABSize=512k
1981
1982
1983 -XX:+UseAdaptiveSizePolicy
1984 Enables the use of adaptive generation sizing. This option is
1985 enabled by default. To disable adaptive generation sizing, specify
1986 -XX:-UseAdaptiveSizePolicy and set the size of the memory
1987 allocation pool explicitly (see the -XX:SurvivorRatio option).
1988
1989 -XX:+UseCMSInitiatingOccupancyOnly
1990 Enables the use of the occupancy value as the only criterion for
1991 initiating the CMS collector. By default, this option is disabled
1992 and other criteria may be used.
1993
1994 -XX:+UseConcMarkSweepGC
1995 Enables the use of the CMS garbage collector for the old
1996 generation. Oracle recommends that you use the CMS garbage
1997 collector when application latency requirements cannot be met by
1998 the throughput (-XX:+UseParallelGC) garbage collector. The G1
1999 garbage collector (-XX:+UseG1GC) is another alternative.
2000
2001 By default, this option is disabled and the collector is chosen
2002 automatically based on the configuration of the machine and type of
2003 the JVM. When this option is enabled, the -XX:+UseParNewGC option
2004 is automatically set and you should not disable it, because the
2005 following combination of options has been deprecated in JDK 8:
2006 -XX:+UseConcMarkSweepGC -XX:-UseParNewGC.
2007
2008 -XX:+UseG1GC
2009 Enables the use of the garbage-first (G1) garbage collector. It is
2010 a server-style garbage collector, targeted for multiprocessor
2011 machines with a large amount of RAM. It meets GC pause time goals
2012 with high probability, while maintaining good throughput. The G1
2013 collector is recommended for applications requiring large heaps
2014 (sizes of around 6 GB or larger) with limited GC latency
2015 requirements (stable and predictable pause time below 0.5 seconds).
2016
2017 By default, this option is disabled and the collector is chosen
2018 automatically based on the configuration of the machine and type of
2019 the JVM.
2020
2021 -XX:+UseGCOverheadLimit
2022 Enables the use of a policy that limits the proportion of time
2023 spent by the JVM on GC before an OutOfMemoryError exception is
2024 thrown. This option is enabled, by default and the parallel GC will
2025 throw an OutOfMemoryError if more than 98% of the total time is
2026 spent on garbage collection and less than 2% of the heap is
2027 recovered. When the heap is small, this feature can be used to
2028 prevent applications from running for long periods of time with
2029 little or no progress. To disable this option, specify
2030 -XX:-UseGCOverheadLimit.
2031
2032 -XX:+UseNUMA
2033 Enables performance optimization of an application on a machine
2034 with nonuniform memory architecture (NUMA) by increasing the
2035 application's use of lower latency memory. By default, this option
2036 is disabled and no optimization for NUMA is made. The option is
2037 only available when the parallel garbage collector is used
2038 (-XX:+UseParallelGC).
2039
2040 -XX:+UseParallelGC
2041 Enables the use of the parallel scavenge garbage collector (also
2042 known as the throughput collector) to improve the performance of
2043 your application by leveraging multiple processors.
2044
2045 By default, this option is disabled and the collector is chosen
2046 automatically based on the configuration of the machine and type of
2047 the JVM. If it is enabled, then the -XX:+UseParallelOldGC option is
2048 automatically enabled, unless you explicitly disable it.
2049
2050 -XX:+UseParallelOldGC
2051 Enables the use of the parallel garbage collector for full GCs. By
2052 default, this option is disabled. Enabling it automatically enables
2053 the -XX:+UseParallelGC option.
2054
2055 -XX:+UseParNewGC
2056 Enables the use of parallel threads for collection in the young
2057 generation. By default, this option is disabled. It is
2058 automatically enabled when you set the -XX:+UseConcMarkSweepGC
2059 option. Using the -XX:+UseParNewGC option without the
2060 -XX:+UseConcMarkSweepGC option was deprecated in JDK 8.
2061
2062 -XX:+UseSerialGC
2063 Enables the use of the serial garbage collector. This is generally
2064 the best choice for small and simple applications that do not
2065 require any special functionality from garbage collection. By
2066 default, this option is disabled and the collector is chosen
2067 automatically based on the configuration of the machine and type of
2068 the JVM.
2069
2070 -XX:+UseSHM
2071 On Linux, enables the JVM to use shared memory to setup large
2072 pages.
2073
2074 For more information, see "Large Pages".
2075
2076 -XX:+UseStringDeduplication
2077 Enables string deduplication. By default, this option is disabled.
2078 To use this option, you must enable the garbage-first (G1) garbage
2079 collector. See the -XX:+UseG1GC option.
2080
2081 String deduplication reduces the memory footprint of String objects
2082 on the Java heap by taking advantage of the fact that many String
2083 objects are identical. Instead of each String object pointing to
2084 its own character array, identical String objects can point to and
2085 share the same character array.
2086
2087 -XX:+UseTLAB
2088 Enables the use of thread-local allocation blocks (TLABs) in the
2089 young generation space. This option is enabled by default. To
2090 disable the use of TLABs, specify -XX:-UseTLAB.
2091
2092 Deprecated and Removed Options
2093 These options were included in the previous release, but have since
2094 been considered unnecessary.
2095
2096 -Xincgc
2097 Enables incremental garbage collection. This option was deprecated
2098 in JDK 8 with no replacement.
2099
2100 -Xrunlibname
2101 Loads the specified debugging/profiling library. This option was
2102 superseded by the -agentlib option.
2103
2104 -XX:CMSIncrementalDutyCycle=percent
2105 Sets the percentage of time (0 to 100) between minor collections
2106 that the concurrent collector is allowed to run. This option was
2107 deprecated in JDK 8 with no replacement, following the deprecation
2108 of the -XX:+CMSIncrementalMode option.
2109
2110 -XX:CMSIncrementalDutyCycleMin=percent
2111 Sets the percentage of time (0 to 100) between minor collections
2112 that is the lower bound for the duty cycle when
2113 -XX:+CMSIncrementalPacing is enabled. This option was deprecated in
2114 JDK 8 with no replacement, following the deprecation of the
2115 -XX:+CMSIncrementalMode option.
2116
2117 -XX:+CMSIncrementalMode
2118 Enables the incremental mode for the CMS collector. This option was
2119 deprecated in JDK 8 with no replacement, along with other options
2120 that start with CMSIncremental.
2121
2122 -XX:CMSIncrementalOffset=percent
2123 Sets the percentage of time (0 to 100) by which the incremental
2124 mode duty cycle is shifted to the right within the period between
2125 minor collections. This option was deprecated in JDK 8 with no
2126 replacement, following the deprecation of the
2127 -XX:+CMSIncrementalMode option.
2128
2129 -XX:+CMSIncrementalPacing
2130 Enables automatic adjustment of the incremental mode duty cycle
2131 based on statistics collected while the JVM is running. This option
2132 was deprecated in JDK 8 with no replacement, following the
2133 deprecation of the -XX:+CMSIncrementalMode option.
2134
2135 -XX:CMSIncrementalSafetyFactor=percent
2136 Sets the percentage of time (0 to 100) used to add conservatism
2137 when computing the duty cycle. This option was deprecated in JDK 8
2138 with no replacement, following the deprecation of the
2139 -XX:+CMSIncrementalMode option.
2140
2141 -XX:CMSInitiatingPermOccupancyFraction=percent
2142 Sets the percentage of the permanent generation occupancy (0 to
2143 100) at which to start a GC. This option was deprecated in JDK 8
2144 with no replacement.
2145
2146 -XX:MaxPermSize=size
2147 Sets the maximum permanent generation space size (in bytes). This
2148 option was deprecated in JDK 8, and superseded by the
2149 -XX:MaxMetaspaceSize option.
2150
2151 -XX:PermSize=size
2152 Sets the space (in bytes) allocated to the permanent generation
2153 that triggers a garbage collection if it is exceeded. This option
2154 was deprecated un JDK 8, and superseded by the -XX:MetaspaceSize
2155 option.
2156
2157 -XX:+UseSplitVerifier
2158 Enables splitting of the verification process. By default, this
2159 option was enabled in the previous releases, and verification was
2160 split into two phases: type referencing (performed by the compiler)
2161 and type checking (performed by the JVM runtime). This option was
2162 deprecated in JDK 8, and verification is now split by default
2163 without a way to disable it.
2164
2165 -XX:+UseStringCache
2166 Enables caching of commonly allocated strings. This option was
2167 removed from JDK 8 with no replacement.
2168
2170 The following examples show how to use experimental tuning flags to
2171 either optimize throughput or to provide lower response time.
2172
2173 Example 1 Tuning for Higher Throughput
2174
2175 java -d64 -server -XX:+UseLargePages -Xmn10g -Xms26g -Xmx26g
2176
2177
2178 Example 2 Tuning for Lower Response Time
2179
2180 java -d64 -XX:+UseG1GC -Xms26g Xmx26g -XX:MaxGCPauseMillis=500 -XX:+PrintGCTimeStamp
2181
2182
2184 Also known as huge pages, large pages are memory pages that are
2185 significantly larger than the standard memory page size (which varies
2186 depending on the processor and operating system). Large pages optimize
2187 processor Translation-Lookaside Buffers.
2188
2189 A Translation-Lookaside Buffer (TLB) is a page translation cache that
2190 holds the most-recently used virtual-to-physical address translations.
2191 TLB is a scarce system resource. A TLB miss can be costly as the
2192 processor must then read from the hierarchical page table, which may
2193 require multiple memory accesses. By using a larger memory page size, a
2194 single TLB entry can represent a larger memory range. There will be
2195 less pressure on TLB, and memory-intensive applications may have better
2196 performance.
2197
2198 However, large pages page memory can negatively affect system
2199 performance. For example, when a large mount of memory is pinned by an
2200 application, it may create a shortage of regular memory and cause
2201 excessive paging in other applications and slow down the entire system.
2202 Also, a system that has been up for a long time could produce excessive
2203 fragmentation, which could make it impossible to reserve enough large
2204 page memory. When this happens, either the OS or JVM reverts to using
2205 regular pages.
2206
2207 Large Pages Support
2208 Solaris and Linux support large pages.
2209
2210 Solaris
2211 Solaris 9 and later include Multiple Page Size Support (MPSS); no
2212 additional configuration is necessary. See
2213 http://www.oracle.com/technetwork/server-storage/solaris10/overview/solaris9-features-scalability-135663.html.
2214
2215 Linux
2216 The 2.6 kernel supports large pages. Some vendors have backported
2217 the code to their 2.4-based releases. To check if your system can
2218 support large page memory, try the following:
2219
2220 # cat /proc/meminfo | grep Huge
2221 HugePages_Total: 0
2222 HugePages_Free: 0
2223 Hugepagesize: 2048 kB
2224
2225
2226 If the output shows the three "Huge" variables, then your system
2227 can support large page memory but it needs to be configured. If the
2228 command prints nothing, then your system does not support large
2229 pages. To configure the system to use large page memory, login as
2230 root, and then follow these steps:
2231
2232 1. If you are using the option -XX:+UseSHM (instead of
2233 -XX:+UseHugeTLBFS), then increase the SHMMAX value. It must be
2234 larger than the Java heap size. On a system with 4 GB of
2235 physical RAM (or less), the following will make all the memory
2236 sharable:
2237
2238 # echo 4294967295 > /proc/sys/kernel/shmmax
2239
2240
2241 2. If you are using the option -XX:+UseSHM or -XX:+UseHugeTLBFS,
2242 then specify the number of large pages. In the following
2243 example, 3 GB of a 4 GB system are reserved for large pages
2244 (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB
2245 = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048
2246 kB = 1536):
2247
2248 # echo 1536 > /proc/sys/vm/nr_hugepages
2249
2250
2251 Note
2252 ┌──────────────────────────────────────────────┐
2253 │ │
2254 │ · Note that the values │
2255 │ contained in /proc │
2256 │ will reset after you │
2257 │ reboot your system, │
2258 │ so may want to set │
2259 │ them in an │
2260 │ initialization │
2261 │ script (for example, │
2262 │ rc.local or │
2263 │ sysctl.conf). │
2264 │ │
2265 │ · If you configure (or │
2266 │ resize) the OS │
2267 │ kernel parameters │
2268 │ /proc/sys/kernel/shmmax │
2269 │ or │
2270 │ /proc/sys/vm/nr_hugepages, │
2271 │ Java processes may │
2272 │ allocate large pages │
2273 │ for areas in │
2274 │ addition to the Java │
2275 │ heap. These steps │
2276 │ can allocate large │
2277 │ pages for the │
2278 │ following areas: │
2279 │ │
2280 │ · Java heap │
2281 │ │
2282 │ · Code cache │
2283 │ │
2284 │ · The marking │
2285 │ bitmap data │
2286 │ structure for │
2287 │ the parallel GC │
2288 │ │
2289 │ Consequently, if you │
2290 │ configure the │
2291 │ nr_hugepages │
2292 │ parameter to the │
2293 │ size of the Java │
2294 │ heap, then the JVM │
2295 │ can fail in │
2296 │ allocating the code │
2297 │ cache areas on large │
2298 │ pages because these │
2299 │ areas are quite │
2300 │ large in size. │
2301 └──────────────────────────────────────────────┘
2302
2304 The following exit values are typically returned by the launcher when
2305 the launcher is called with the wrong arguments, serious errors, or
2306 exceptions thrown by the JVM. However, a Java application may choose to
2307 return any value by using the API call System.exit(exitValue). The
2308 values are:
2309
2310 · 0: Successful completion
2311
2312 · >0: An error occurred
2313
2315 · javac(1)
2316
2317 · jdb(1)
2318
2319 · jar(1)
2320
2321 · jstat(1)
2322
2323
2324
2325JDK 8 03 March 2015 java(1)