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