1JAVA(1)                          JDK Commands                          JAVA(1)
2
3
4

NAME

6       java - launch a Java application
7

SYNOPSIS

9       To launch a class file:
10
11       java [options] mainclass [args ...]
12
13       To launch the main class in a JAR file:
14
15       java [options] -jar jarfile [args ...]
16
17       To launch the main class in a module:
18
19       java [options] -m module[/mainclass] [args ...]
20
21       or
22
23       java [options] --module module[/mainclass] [args ...]
24
25       To launch a single source-file program:
26
27       java [options] source-file [args ...]
28
29       options
30              Optional:  Specifies  command-line  options separated by spaces.
31              See Overview of Java Options for a description of available  op‐
32              tions.
33
34       mainclass
35              Specifies  the  name  of the class to be launched.  Command-line
36              entries following classname  are  the  arguments  for  the  main
37              method.
38
39       -jar jarfile
40              Executes  a program encapsulated in a JAR file.  The jarfile ar‐
41              gument is the name of a JAR file with a manifest that contains a
42              line  in  the  form  Main-Class:classname that defines the class
43              with  the  public static void main(String[] args)  method   that
44              serves as your application's starting point.  When you use -jar,
45              the specified JAR file is the source of all  user  classes,  and
46              other  class  path  settings  are  ignored.  If you're using JAR
47              files, then see jar.
48
49       -m or --module module[/mainclass]
50              Executes the main class in a module specified by mainclass if it
51              is  given,  or, if it is not given, the value in the module.  In
52              other words, mainclass can be used when it is not  specified  by
53              the module, or to override the value when it is specified.
54
55              See Standard Options for Java.
56
57       source-file
58              Only used to launch a single source-file program.  Specifies the
59              source file that contains the main class when using  source-file
60              mode.    See   Using  Source-File  Mode  to  Launch  Single-File
61              Source-Code Programs
62
63       args ...
64              Optional:  Arguments  following  mainclass,  source-file,   -jar
65              jarfile, and -m or --module module/mainclass are passed as argu‐
66              ments to the main class.
67

DESCRIPTION

69       The java command starts a Java application.  It does this  by  starting
70       the  Java Virtual Machine (JVM), loading the specified class, and call‐
71       ing that class's main() method.  The method must be declared public and
72       static, it must not return any value, and it must accept a String array
73       as a parameter.  The method declaration has the following form:
74
75              public static void main(String[] args)
76
77       In source-file mode, the java command can launch a class declared in  a
78       source   file.   See  Using  Source-File  Mode  to  Launch  Single-File
79       Source-Code Programs for a description of using the source-file mode.
80
81              Note: You can  use  the  JDK_JAVA_OPTIONS  launcher  environment
82              variable  to  prepend  its content to the actual command line of
83              the java launcher.  See Using the JDK_JAVA_OPTIONS Launcher  En‐
84              vironment Variable.
85
86       By default, the first argument that isn't an option of the java command
87       is the fully qualified name of the class to  be  called.   If  -jar  is
88       specified,  then  its  argument  is the name of the JAR file containing
89       class and resource files for the application.  The startup  class  must
90       be indicated by the Main-Class manifest header in its manifest file.
91
92       Arguments  after the class file name or the JAR file name are passed to
93       the main() method.
94
95   javaw
96       Windows: The javaw command is identical to java, except that with javaw
97       there's  no associated console window.  Use javaw when you don't want a
98       command prompt window to appear.  The  javaw  launcher  will,  however,
99       display a dialog box with error information if a launch fails.
100

USING SOURCE-FILE MODE TO LAUNCH SINGLE-FILE SOURCE-CODE PROGRAMS

102       To  launch  a class declared in a source file, run the java launcher in
103       source-file mode.  Entering source-file mode is determined by two items
104       on the java command line:
105
106       · The  first  item on the command line that is not an option or part of
107         an option.  In other words, the item in the command line  that  would
108         otherwise be the main class name.
109
110       · The --source version option, if present.
111
112       If the class identifies an existing file that has a .java extension, or
113       if the --source option is specified, then source-file mode is selected.
114       The  source  file is then compiled and run.  The --source option can be
115       used to specify the source version or N of the source code.   This  de‐
116       termines  the  API  that can be used.  When you set --source N, you can
117       only use the public API that was defined in JDK N.
118
119              Note: The valid values of N change for each  release,  with  new
120              values  added  and old values removed.  You'll get an error mes‐
121              sage if you use a value of N that is no longer supported.   Sup‐
122              ported values of N for this release are 7, 8, 9, 10, 11, 12, 13,
123              and 14.
124
125       If the file does not have the .java extension, the --source option must
126       be  used  to  tell  the  java command to use the source-file mode.  The
127       --source option is used for cases when the source file is a "script" to
128       be  executed and the name of the source file does not follow the normal
129       naming conventions for Java source files.
130
131       In source-file mode, the effect is as though the source  file  is  com‐
132       piled into memory, and the first class found in the source file is exe‐
133       cuted.  Any arguments placed after the name of the source file  in  the
134       original  command line are passed to the compiled class when it is exe‐
135       cuted.
136
137       For example, if a file were named HelloWorld.java and contained a class
138       named  hello.World,  then  the  source-file  mode command to launch the
139       class would be:
140
141              java HelloWorld.java
142
143       The example illustrates that the class can be in a named  package,  and
144       does  not  need  to be in the unnamed package.  This use of source-file
145       mode is informally equivalent to using the following two commands where
146       hello.World is the name of the class in the package:
147
148              javac -d <memory> HelloWorld.java
149              java -cp <memory> hello.World
150
151       In  source-file mode, any additional command-line options are processed
152       as follows:
153
154       · The launcher scans the options specified before the source  file  for
155         any that are relevant in order to compile the source file.
156
157         This includes: --class-path, --module-path, --add-exports, --add-mod‐
158         ules, --limit-modules, --patch-module, --upgrade-module-path, and any
159         variant  forms  of  those  options.   It  also includes the new --en‐
160         able-preview option, described in JEP 12.
161
162       · No provision is made to pass any additional options to the  compiler,
163         such as -processor or -Werror.
164
165       · Command-line  argument  files  (@-files)  may be used in the standard
166         way.  Long lists of arguments for either the VM or the program  being
167         invoked  may be placed in files specified on the command-line by pre‐
168         fixing the filename with an @ character.
169
170       In source-file mode, compilation proceeds as follows:
171
172       · Any command-line options that are relevant to the  compilation  envi‐
173         ronment are taken into account.
174
175       · No  other  source files are found and compiled, as if the source path
176         is set to an empty value.
177
178       · Annotation processing is disabled, as if -proc:none is in effect.
179
180       · If a version is specified, via the --source option, the value is used
181         as the argument for an implicit --release option for the compilation.
182         This sets both the source version accepted by compiler and the system
183         API that may be used by the code in the source file.
184
185       · The source file is compiled in the context of an unnamed module.
186
187       · The  source  file  should  contain one or more top-level classes, the
188         first of which is taken as the class to be executed.
189
190       · The compiler does not enforce the optional restriction defined at the
191         end  of  JLS  ??7.6, that a type in a named package should exist in a
192         file whose name is composed from the type name followed by the  .java
193         extension.
194
195       · If  the  source  file contains errors, appropriate error messages are
196         written to the standard error stream, and the launcher exits  with  a
197         non-zero exit code.
198
199       In source-file mode, execution proceeds as follows:
200
201       · The  class  to  be executed is the first top-level class found in the
202         source file.  It must contain a  declaration  of  the  standard  pub‐
203         lic static void main(String[]) method.
204
205       · The  compiled classes are loaded by a custom class loader, that dele‐
206         gates to the application class loader.  This implies that classes ap‐
207         pearing on the application class path cannot refer to any classes de‐
208         clared in the source file.
209
210       · The compiled classes are executed in the context of an  unnamed  mod‐
211         ule,  as  though  --add-modules=ALL-DEFAULT is in effect.  This is in
212         addition to any other --add-module options  that  may  be  have  been
213         specified on the command line.
214
215       · Any  arguments  appearing  after  the name of the file on the command
216         line are passed to the standard main method in the obvious way.
217
218       · It is an error if there is a class  on  the  application  class  path
219         whose name is the same as that of the class to be executed.
220
221       See  JEP  330:  Launch  Single-File  Source-Code Programs [http://open
222       jdk.java.net/jeps/330] for complete details.
223

USING THE JDK_JAVA_OPTIONS LAUNCHER ENVIRONMENT VARIABLE

225       JDK_JAVA_OPTIONS prepends its content to the options  parsed  from  the
226       command line.  The content of the JDK_JAVA_OPTIONS environment variable
227       is a list of arguments separated by white-space characters  (as  deter‐
228       mined by isspace()).  These are prepended to the command line arguments
229       passed to java launcher.  The encoding requirement for the  environment
230       variable  is  the same as the java command line on the system.  JDK_JA‐
231       VA_OPTIONS environment variable content is treated in the  same  manner
232       as that specified in the command line.
233
234       Single  (')  or double (") quotes can be used to enclose arguments that
235       contain whitespace characters.  All content between the open quote  and
236       the  first  matching  close  quote are preserved by simply removing the
237       pair of quotes.  In case a matching quote is not  found,  the  launcher
238       will  abort  with  an error message.  @-files are supported as they are
239       specified in the command line.  However, as in @-files, use of a  wild‐
240       card  is  not  supported.   In  order  to  mitigate potential misuse of
241       JDK_JAVA_OPTIONS behavior, options that specify the main class (such as
242       -jar)  or  cause  the  java launcher to exit without executing the main
243       class (such as -h) are disallowed in the environment variable.  If  any
244       of  these options appear in the environment variable, the launcher will
245       abort with an error message.  When JDK_JAVA_OPTIONS is set, the launch‐
246       er prints a message to stderr as a reminder.
247
248       Example:
249
250              $ export JDK_JAVA_OPTIONS='-g @file1 -Dprop=value @file2 -Dws.prop="white spaces"'
251              $ java -Xint @file3
252
253       is equivalent to the command line:
254
255              java -g @file1 -Dprop=value @file2 -Dws.prop="white spaces" -Xint @file3
256

OVERVIEW OF JAVA OPTIONS

258       The java command supports a wide range of options in the following cat‐
259       egories:
260
261       · Standard Options for Java: Options guaranteed to be supported by  all
262         implementations  of the Java Virtual Machine (JVM).  They're used for
263         common actions, such as checking the version of the JRE, setting  the
264         class path, enabling verbose output, and so on.
265
266       · Extra  Options for Java: General purpose options that are specific to
267         the Java HotSpot Virtual Machine.  They aren't guaranteed to be  sup‐
268         ported  by all JVM implementations, and are subject to change.  These
269         options start with -X.
270
271       The advanced options aren't recommended for casual use.  These are  de‐
272       veloper options used for tuning specific areas of the Java HotSpot Vir‐
273       tual Machine operation that often have specific system requirements and
274       may require privileged access to system configuration parameters.  Sev‐
275       eral examples of performance tuning are provided in Performance  Tuning
276       Examples.   These  options aren't guaranteed to be supported by all JVM
277       implementations and are subject to change.  Advanced options start with
278       -XX.
279
280       · Advanced  Runtime  Options  for Java: Control the runtime behavior of
281         the Java HotSpot VM.
282
283       · Advanced  JIT  Compiler  Options  for  java:  Control   the   dynamic
284         just-in-time (JIT) compilation performed by the Java HotSpot VM.
285
286       · Advanced Serviceability Options for Java: Enable gathering system in‐
287         formation and performing extensive debugging.
288
289       · Advanced Garbage Collection Options for  Java:  Control  how  garbage
290         collection (GC) is performed by the Java HotSpot
291
292       Boolean  options are used to either enable a feature that's disabled by
293       default or disable a feature that's enabled by default.   Such  options
294       don't  require  a parameter.  Boolean -XX options are enabled using the
295       plus sign (-XX:+OptionName) and disabled using the minus sign (-XX:-Op‐
296       tionName).
297
298       For  options  that  require  an argument, the argument may be separated
299       from the option name by a space, a colon (:), or an equal sign (=),  or
300       the  argument  may directly follow the option (the exact syntax differs
301       for each option).  If you're expected to specify  the  size  in  bytes,
302       then  you  can  use  no  suffix, or use the suffix k or K for kilobytes
303       (KB), m or M for megabytes (MB), or g or G for gigabytes (GB).  For ex‐
304       ample,  to  set  the  size  to  8 GB, you can specify either 8g, 8192m,
305       8388608k, or 8589934592 as the argument.  If you are expected to speci‐
306       fy the percentage, then use a number from 0 to 1.  For example, specify
307       0.25 for 25%.
308
309       The following sections describe the options that are  obsolete,  depre‐
310       cated, and removed:
311
312       · Deprecated Java Options: Accepted and acted upon --- a warning is is‐
313         sued when they're used.
314
315       · Obsolete Java Options: Accepted but ignored --- a warning  is  issued
316         when they're used.
317
318       · Removed Java Options: Removed --- using them results in an error.
319

STANDARD OPTIONS FOR JAVA

321       These  are  the most commonly used options supported by all implementa‐
322       tions of the JVM.
323
324              Note: To specify an argument for a long option, you can use  ei‐
325              ther --name=value or --name value.
326
327       -agentlib:libname[=options]
328              Loads  the  specified  native  agent library.  After the library
329              name, a comma-separated list of options specific to the  library
330              can be used.
331
332              · Oracle  Solaris, Linux, and macOS: If the option -agentlib:foo
333                is specified, then the JVM attempts to load the library  named
334                libfoo.so  in  the  location  specified by the LD_LIBRARY_PATH
335                system variable (on macOS this variable is DYLD_LIBRARY_PATH).
336
337              · Windows: If the option -agentlib:foo is  specified,  then  the
338                JVM attempts to load the library named foo.dll in the location
339                specified by the PATH system variable.
340
341                The following example shows how to load the  Java  Debug  Wire
342                Protocol  (JDWP)  library and listen for the socket connection
343                on port 8000, suspending the JVM before the main class loads:
344
345                       -agentlib:jdwp=transport=dt_socket,server=y,ad‐
346                       dress=8000
347
348       -agentpath:pathname[=options]
349              Loads  the  native  agent library specified by the absolute path
350              name.  This option is equivalent to -agentlib but uses the  full
351              path and file name of the library.
352
353       --class-path classpath, -classpath classpath, or -cp classpath
354              A semicolon (;) separated list of directories, JAR archives, and
355              ZIP archives to search for class files.
356
357              Specifying classpath overrides any setting of the CLASSPATH  en‐
358              vironment  variable.   If  the  class path option isn't used and
359              classpath isn't set, then the user class path  consists  of  the
360              current directory (.).
361
362              As  a  special convenience, a class path element that contains a
363              base name of an asterisk (*) is considered equivalent to  speci‐
364              fying  a  list of all the files in the directory with the exten‐
365              sion .jar or .JAR .  A Java program can't  tell  the  difference
366              between  the two invocations.  For example, if the directory my‐
367              dir contains a.jar and b.JAR, then the class  path  element  my‐
368              dir/*  is  expanded to A.jar:b.JAR, except that the order of JAR
369              files is unspecified.  All .jar files in the specified  directo‐
370              ry,  even  hidden  ones, are included in the list.  A class path
371              entry consisting of an asterisk (*) expands to a list of all the
372              jar  files  in the current directory.  The CLASSPATH environment
373              variable, where defined, is similarly expanded.  Any class  path
374              wildcard  expansion  that  occurs before the Java VM is started.
375              Java programs never see wildcards that aren't expanded except by
376              querying    the   environment,   such   as   by   calling   Sys‐
377              tem.getenv("CLASSPATH").
378
379       --disable-@files
380              Can be used anywhere on the command line, including in an  argu‐
381              ment  file, to prevent further @filename expansion.  This option
382              stops expanding @-argfiles after the option.
383
384       --enable-preview
385              Allows classes to depend on preview features  [https://docs.ora
386              cle.com/en/java/javase/12/language/index.html#JS‐
387              LAN-GUID-5A82FE0E-0CA4-4F1F-B075-564874FE2823] of the release.
388
389       --module-path modulepath... or -p modulepath
390              A semicolon (;) separated list of directories in which each  di‐
391              rectory is a directory of modules.
392
393       --upgrade-module-path modulepath...
394              A  semicolon (;) separated list of directories in which each di‐
395              rectory is a directory of modules that replace upgradeable  mod‐
396              ules in the runtime image.
397
398       --add-modules module[,module...]
399              Specifies the root modules to resolve in addition to the initial
400              module.   module  also  can  be  ALL-DEFAULT,  ALL-SYSTEM,   and
401              ALL-MODULE-PATH.
402
403       --list-modules
404              Lists the observable modules and then exits.
405
406       -d module_name or --describe-module module_name
407              Describes a specified module and then exits.
408
409       --dry-run
410              Creates  the  VM  but  doesn't  execute  the  main method.  This
411              --dry-run option might be useful for validating the command-line
412              options such as the module system configuration.
413
414       --validate-modules
415              Validates  all  modules  and  exit.   This option is helpful for
416              finding conflicts and other errors with modules  on  the  module
417              path.
418
419       -Dproperty=value
420              Sets a system property value.  The property variable is a string
421              with no spaces that represents the name of  the  property.   The
422              value  variable  is  a  string  that represents the value of the
423              property.  If value is a string with spaces, then enclose it  in
424              quotation marks (for example -Dfoo="foo bar").
425
426       -disableassertions[:[packagename]...|:classname]    or   -da[:[package‐
427       name]...|:classname]
428              Disables assertions.  By default, assertions are disabled in all
429              packages  and  classes.   With  no arguments, -disableassertions
430              (-da) disables assertions in all packages and classes.  With the
431              packagename  argument  ending in ..., the switch disables asser‐
432              tions in the specified package and any subpackages.  If the  ar‐
433              gument is simply ..., then the switch disables assertions in the
434              unnamed package in the  current  working  directory.   With  the
435              classname argument, the switch disables assertions in the speci‐
436              fied class.
437
438              The -disableassertions (-da) option applies to all class loaders
439              and  to  system  classes  (which  don't  have  a  class loader).
440              There's one exception to this rule: If the  option  is  provided
441              with  no  arguments,  then  it  doesn't apply to system classes.
442              This makes it easy to disable assertions in all  classes  except
443              for system classes.  The -disablesystemassertions option enables
444              you to disable assertions in all system classes.  To  explicitly
445              enable  assertions in specific packages or classes, use the -en‐
446              ableassertions (-ea) option.  Both options can be  used  at  the
447              same time.  For example, to run the MyClass application with as‐
448              sertions enabled in the  package  com.wombat.fruitbat  (and  any
449              subpackages)   but   disabled  in  the  class  com.wombat.fruit‐
450              bat.Brickbat, use the following command:
451
452                     java -ea:com.wombat.fruitbat... -da:com.wombat.fruit‐
453                     bat.Brickbat MyClass
454
455       -disablesystemassertions or -dsa
456              Disables assertions in all system classes.
457
458       -enableassertions[:[packagename]...|:classname]    or    -ea[:[package‐
459       name]...|:classname]
460              Enables assertions.  By default, assertions are disabled in  all
461              packages  and  classes.   With  no  arguments, -enableassertions
462              (-ea) enables assertions in all packages and classes.  With  the
463              packagename  argument  ending  in ..., the switch enables asser‐
464              tions in the specified package and any subpackages.  If the  ar‐
465              gument  is simply ..., then the switch enables assertions in the
466              unnamed package in the  current  working  directory.   With  the
467              classname  argument, the switch enables assertions in the speci‐
468              fied class.
469
470              The -enableassertions (-ea) option applies to all class  loaders
471              and  to  system  classes  (which  don't  have  a  class loader).
472              There's one exception to this rule: If the  option  is  provided
473              with  no  arguments,  then  it  doesn't apply to system classes.
474              This makes it easy to enable assertions in  all  classes  except
475              for system classes.  The -enablesystemassertions option provides
476              a separate switch to enable assertions in  all  system  classes.
477              To  explicitly disable assertions in specific packages or class‐
478              es, use the -disableassertions (-da) option.  If a  single  com‐
479              mand contains multiple instances of these switches, then they're
480              processed in order, before loading any classes.  For example, to
481              run  the MyClass application with assertions enabled only in the
482              package com.wombat.fruitbat (and any subpackages)  but  disabled
483              in  the  class  com.wombat.fruitbat.Brickbat,  use the following
484              command:
485
486                     java -ea:com.wombat.fruitbat... -da:com.wombat.fruit‐
487                     bat.Brickbat MyClass
488
489       -enablesystemassertions or -esa
490              Enables assertions in all system classes.
491
492       -help, -h, or -?
493              Prints the help message to the error stream.
494
495       --help Prints the help message to the output stream.
496
497       -javaagent:jarpath[=options]
498              Loads  the  specified  Java programming language agent.  See ja‐
499              va.lang.instrument.
500
501       --show-version
502              Prints the product version to the output stream and continues.
503
504       -showversion
505              Prints the product version to the error stream and continues.
506
507       --show-module-resolution
508              Shows module resolution output during startup.
509
510       -splash:imagepath
511              Shows the splash screen with the image specified  by  imagepath.
512              HiDPI  scaled  images  are  automatically  supported and used if
513              available.  The unscaled image file  name,  such  as  image.ext,
514              should  always  be passed as the argument to the -splash option.
515              The most appropriate scaled image provided is picked up automat‐
516              ically.
517
518              For  example, to show the splash.gif file from the images direc‐
519              tory when starting your application, use the following option:
520
521                     -splash:images/splash.gif
522
523              See the SplashScreen API documentation for more information.
524
525       -verbose:class
526              Displays information about each loaded class.
527
528       -verbose:gc
529              Displays information about each garbage collection (GC) event.
530
531       -verbose:jni
532              Displays information about the use of native methods  and  other
533              Java Native Interface (JNI) activity.
534
535       -verbose:module
536              Displays information about the modules in use.
537
538       --version
539              Prints product version to the output stream and exits.
540
541       -version
542              Prints product version to the error stream and exits.
543
544       -X     Prints the help on extra options to the error stream.
545
546       --help-extra
547              Prints the help on extra options to the output stream.
548
549       @argfile
550              Specifies  one  or more argument files prefixed by @ used by the
551              java command.  It isn't uncommon for the java command line to be
552              very  long  because  of  the .jar files needed in the classpath.
553              The @argfile option overcomes command-line length limitations by
554              enabling  the  launcher to expand the contents of argument files
555              after shell expansion, but before argument processing.  Contents
556              in the argument files are expanded because otherwise, they would
557              be specified on the command line until the --disable-@files  op‐
558              tion was encountered.
559
560              The  argument files can also contain the main class name and all
561              options.  If an argument file contains all of  the  options  re‐
562              quired  by  the java command, then the command line could simply
563              be:
564
565                     java @argfile
566
567              See java Command-Line Argument Files for a description and exam‐
568              ples of using @-argfiles.
569

EXTRA OPTIONS FOR JAVA

571       The following java options are general purpose options that are specif‐
572       ic to the Java HotSpot Virtual Machine.
573
574       -Xbatch
575              Disables background compilation.  By default, the  JVM  compiles
576              the  method  as  a background task, running the method in inter‐
577              preter mode until the background compilation is  finished.   The
578              -Xbatch flag disables background compilation so that compilation
579              of all methods proceeds as a foreground  task  until  completed.
580              This option is equivalent to -XX:-BackgroundCompilation.
581
582       -Xbootclasspath/a:directories|zip|JAR-files
583              Specifies  a list of directories, JAR files, and ZIP archives to
584              append to the end of the default bootstrap class path.
585
586              Oracle Solaris, Linux, and macOS: Colons (:)  separate  entities
587              in this list.
588
589              Windows: Semicolons (;) separate entities in this list.
590
591       -Xcheck:jni
592              Performs additional checks for Java Native Interface (JNI) func‐
593              tions.  Specifically, it validates the parameters passed to  the
594              JNI  function and the runtime environment data before processing
595              the JNI request.  It also checks for pending exceptions  between
596              JNI  calls.  Any invalid data encountered indicates a problem in
597              the native code, and the JVM terminates  with  an  irrecoverable
598              error in such cases.  Expect a performance degradation when this
599              option is used.
600
601       -Xdebug
602              Does nothing.  Provided for backward compatibility.
603
604       -Xdiag Shows additional diagnostic messages.
605
606       -Xint  Runs the application in interpreted-only mode.   Compilation  to
607              native code is disabled, and all bytecode is executed by the in‐
608              terpreter.  The performance benefits offered by the just-in-time
609              (JIT) compiler aren't present in this mode.
610
611       -Xinternalversion
612              Displays more detailed JVM version information than the -version
613              option, and then exits.
614
615       -Xlog:option
616              Configure or enable logging with the Java Virtual Machine  (JVM)
617              unified logging framework.  See Enable Logging with the JVM Uni‐
618              fied Logging Framework.
619
620       -Xmixed
621              Executes all bytecode by the interpreter except for hot methods,
622              which are compiled to native code.  On by default.  Use -Xint to
623              switch off.
624
625       -Xmn size
626              Sets the initial and maximum size (in bytes) of the heap for the
627              young  generation (nursery) in the generational collectors.  Ap‐
628              pend the letter k or K to indicate kilobytes, m or M to indicate
629              megabytes,  or  g or G to indicate gigabytes.  The young genera‐
630              tion region of the heap is used for new  objects.   GC  is  per‐
631              formed  in this region more often than in other regions.  If the
632              size for the young generation is too small, then a lot of  minor
633              garbage  collections  are  performed.  If the size is too large,
634              then only full garbage collections are performed, which can take
635              a  long time to complete.  It is recommended that you do not set
636              the size for the young generation for the G1 collector, and keep
637              the size for the young generation greater than 25% and less than
638              50% of the overall heap size for other collectors.  The  follow‐
639              ing  examples  show  how  to set the initial and maximum size of
640              young generation to 256 MB using various units:
641
642                     -Xmn256m
643                     -Xmn262144k
644                     -Xmn268435456
645
646              Instead of the -Xmn option to set both the initial  and  maximum
647              size  of the heap for the young generation, you can use -XX:New‐
648              Size to set the initial size and -XX:MaxNewSize to set the maxi‐
649              mum size.
650
651       -Xms size
652              Sets  the minimum and initial size (in bytes) of the heap.  This
653              value must be a multiple of 1024 and greater than 1 MB.   Append
654              the  letter  k  or  K  to indicate kilobytes, m or M to indicate
655              megabytes, g or G to indicate gigabytes.  The following examples
656              show how to set the size of allocated memory to 6 MB using vari‐
657              ous units:
658
659                     -Xms6291456
660                     -Xms6144k
661                     -Xms6m
662
663              Instead of the -Xms option to set both the minimum  and  initial
664              size of the heap, you can use -XX:MinHeapSize to set the minimum
665              size and -XX:InitialHeapSize to set the initial size.
666
667              If you don't set this option, the initial size is set as the sum
668              of the sizes allocated for the old generation and the young gen‐
669              eration.  The initial size of the heap for the young  generation
670              can be set using the -Xmn option or the -XX:NewSize option.
671
672       -Xmx size
673              Specifies  the  maximum size (in bytes) of the heap.  This value
674              must be a multiple of 1024 and greater than 2  MB.   Append  the
675              letter  k  or  K  to  indicate  kilobytes,  m  or  M to indicate
676              megabytes, or g or G to indicate gigabytes.  The  default  value
677              is  chosen at runtime based on system configuration.  For server
678              deployments, -Xms and -Xmx are often set to the same value.  The
679              following  examples  show how to set the maximum allowed size of
680              allocated memory to 80 MB using various units:
681
682                     -Xmx83886080
683                     -Xmx81920k
684                     -Xmx80m
685
686              The -Xmx option is equivalent to -XX:MaxHeapSize.
687
688       -Xnoclassgc
689              Disables garbage collection (GC) of classes.  This can save some
690              GC  time,  which  shortens  interruptions during the application
691              run.  When you specify -Xnoclassgc at startup, the class objects
692              in  the  application are left untouched during GC and are always
693              be considered live.  This can result in more memory being perma‐
694              nently   occupied  which,  if  not  used  carefully,  throws  an
695              out-of-memory exception.
696
697       -Xrs   Reduces the use of operating system signals by the  JVM.   Shut‐
698              down  hooks enable the orderly shutdown of a Java application by
699              running user cleanup code (such as closing database connections)
700              at shutdown, even if the JVM terminates abruptly.
701
702              · Oracle Solaris, Linux, and macOS:
703
704                · The  JVM catches signals to implement shutdown hooks for un‐
705                  expected termination.  The  JVM  uses  SIGHUP,  SIGINT,  and
706                  SIGTERM to initiate the running of shutdown hooks.
707
708                · Applications  embedding the JVM frequently need to trap sig‐
709                  nals such as SIGINT or SIGTERM, which can lead to  interfer‐
710                  ence  with  the  JVM  signal  handlers.   The -Xrs option is
711                  available to address this issue.  When  -Xrs  is  used,  the
712                  signal masks for SIGINT, SIGTERM, SIGHUP, and SIGQUIT aren't
713                  changed by the JVM, and signal handlers  for  these  signals
714                  aren't installed.
715
716              · Windows:
717
718                · The  JVM  watches  for  console  control events to implement
719                  shutdown hooks for  unexpected  termination.   Specifically,
720                  the  JVM  registers  a  console  control handler that begins
721                  shutdown-hook processing and returns TRUE for  CTRL_C_EVENT,
722                  CTRL_CLOSE_EVENT,    CTRL_LOGOFF_EVENT,    and    CTRL_SHUT‐
723                  DOWN_EVENT.
724
725                · The JVM uses a similar mechanism to implement the feature of
726                  dumping  thread stacks for debugging purposes.  The JVM uses
727                  CTRL_BREAK_EVENT to perform thread dumps.
728
729                · If the JVM is run as a service (for example,  as  a  servlet
730                  engine  for  a  web  server),  then  it can receive CTRL_LO‐
731                  GOFF_EVENT but shouldn't initiate shutdown because the oper‐
732                  ating  system  doesn't  actually  terminate the process.  To
733                  avoid possible interference such as this,  the  -Xrs  option
734                  can  be used.  When the -Xrs option is used, the JVM doesn't
735                  install a console control handler, implying that it  doesn't
736                  watch   for   or   process  CTRL_C_EVENT,  CTRL_CLOSE_EVENT,
737                  CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT.
738
739              There are two consequences of specifying -Xrs:
740
741              · Oracle Solaris, Linux, and macOS: SIGQUIT thread dumps  aren't
742                available.
743
744              · Windows: Ctrl + Break thread dumps aren't available.
745
746              User  code is responsible for causing shutdown hooks to run, for
747              example, by calling the System.exit() when the JVM is to be ter‐
748              minated.
749
750       -Xshare:mode
751              Sets the class data sharing (CDS) mode.
752
753              Possible mode arguments for this option include the following:
754
755              auto   Use shared class data if possible (default).
756
757              on     Require using shared class data, otherwise fail.
758
759                     Note:  The -Xshare:on option is used for testing purposes
760                     only and may cause intermittent failures due to  the  use
761                     of  address  space  layout randomization by the operation
762                     system.  This option should not be used in production en‐
763                     vironments.
764
765              off    Do not attempt to use shared class data.
766
767       -XshowSettings
768              Shows all settings and then continues.
769
770       -XshowSettings:category
771              Shows  settings  and continues.  Possible category arguments for
772              this option include the following:
773
774              all    Shows all categories of settings.  This  is  the  default
775                     value.
776
777              locale Shows settings related to locale.
778
779              properties
780                     Shows settings related to system properties.
781
782              vm     Shows the settings of the JVM.
783
784              system Linux:  Shows  host system or container configuration and
785                     continues.
786
787       -Xss size
788              Sets the thread stack size (in bytes).  Append the letter k or K
789              to indicate KB, m or M to indicate MB, or g or G to indicate GB.
790              The default value depends on the platform:
791
792              · Linux/x64 (64-bit): 1024 KB
793
794              · macOS (64-bit): 1024 KB
795
796              · Oracle Solaris (64-bit): 1024 KB
797
798              · Windows: The default value depends on virtual memory
799
800              The following examples set the thread stack size to 1024  KB  in
801              different units:
802
803                     -Xss1m
804                     -Xss1024k
805                     -Xss1048576
806
807              This option is similar to -XX:ThreadStackSize.
808
809       --add-reads module=target-module(,target-module)*
810              Updates module to read the target-module, regardless of the mod‐
811              ule declaration.  target-module can be all unnamed to  read  all
812              unnamed modules.
813
814       --add-exports module/package=target-module(,target-module)*
815              Updates module to export package to target-module, regardless of
816              module declaration.  The target-module can be all unnamed to ex‐
817              port to all unnamed modules.
818
819       --add-opens module/package=target-module(,target-module)*
820              Updates  module  to open package to target-module, regardless of
821              module declaration.
822
823       --illegal-access=parameter
824              When present at run time, --illegal-access= takes a keyword  pa‐
825              rameter to specify a mode of operation:
826
827                     Note: This option will be removed in a future release.
828
829              · permit:  This  mode  opens  each package in each module in the
830                run-time image to code in all unnamed modules ( such  as  code
831                on  the  class  path), if that package existed in JDK 8.  This
832                enables both static access, (for example,  by  compiled  byte‐
833                code, and deep reflective access) through the platform's vari‐
834                ous reflection APIs.  The first reflective-access operation to
835                any  such  package causes a warning to be issued.  However, no
836                warnings are issued after the first occurrence.   This  single
837                warning  describes  how to enable further warnings.  This mode
838                is the default for the current JDK but will change in a future
839                release.
840
841              · warn:  This  mode is identical to permit except that a warning
842                message is issued for each  illegal  reflective-access  opera‐
843                tion.
844
845              · debug: This mode is identical to warn except that both a warn‐
846                ing message and a stack trace are issued for each illegal  re‐
847                flective-access operation.
848
849              · deny:  This mode disables all illegal-access operations except
850                for those enabled  by  other  command-line  options,  such  as
851                --add-opens.   This  mode  will become the default in a future
852                release.
853
854              The default mode, --illegal-access=permit, is intended  to  make
855              you  aware  of code on the class path that reflectively accesses
856              any JDK-internal APIs at least once.  To learn  about  all  such
857              accesses, you can use the warn or the debug modes.  For each li‐
858              brary or framework on the class path that requires  illegal  ac‐
859              cess, you have two options:
860
861              · If  the  component's maintainers have already released a fixed
862                version that no longer uses JDK-internal  APIs  then  you  can
863                consider upgrading to that version.
864
865              · If the component still needs to be fixed, then you can contact
866                its maintainers and ask them to replace their use  of  JDK-in‐
867                ternal APIs with the proper exported APIs.
868
869              If  you  must  continue to use a component that requires illegal
870              access, then you can eliminate the warning messages by using one
871              or more --add-opens options to open only those internal packages
872              to which access is required.
873
874              To verify that your application is ready for a future version of
875              the JDK, run it with --illegal-access=deny along with any neces‐
876              sary --add-opens options.  Any remaining  illegal-access  errors
877              will  most likely be due to static references from compiled code
878              to JDK-internal APIs.  You can identify  those  by  running  the
879              jdeps  tool  with  the  --jdk-internals option.  For performance
880              reasons, the current JDK does not  issue  warnings  for  illegal
881              static-access operations.
882
883       --limit-modules module[,module...]
884              Specifies the limit of the universe of observable modules.
885
886       --patch-module module=file(;file)*
887              Overrides or augments a module with classes and resources in JAR
888              files or directories.
889
890       --source version
891              Sets the version of the source in source-file mode.
892

EXTRA OPTIONS FOR MACOS

894       The following extra options are macOS specific.
895
896       -XstartOnFirstThread
897              Runs the main() method on the first (AppKit) thread.
898
899       -Xdock:name=application_name
900              Overrides the default application name displayed in dock.
901
902       -Xdock:icon=path_to_icon_file
903              Overrides the default icon displayed in dock.
904

ADVANCED OPTIONS FOR JAVA

906       These java options can be used to enable other advanced options.
907
908       -XX:+UnlockDiagnosticVMOptions
909              Unlocks the options intended for diagnosing  the  JVM.   By  de‐
910              fault,  this  option  is  disabled and diagnostic options aren't
911              available.
912
913              Command line options that are enabled with the use of  this  op‐
914              tion are not supported.  If you encounter issues while using any
915              of these options, it is very likely that you will be required to
916              reproduce the problem without using any of these unsupported op‐
917              tions before Oracle Support can assist  with  an  investigation.
918              It  is also possible that any of these options may be removed or
919              their behavior changed without any warning.
920
921       -XX:+UnlockExperimentalVMOptions
922              Unlocks the options that provide experimental  features  in  the
923              JVM.   By default, this option is disabled and experimental fea‐
924              tures aren't available.
925

ADVANCED RUNTIME OPTIONS FOR JAVA

927       These java options control the runtime behavior of the Java HotSpot VM.
928
929       -XX:ActiveProcessorCount=x
930              Overrides the number of CPUs that the VM will use  to  calculate
931              the size of thread pools it will use for various operations such
932              as Garbage Collection and ForkJoinPool.
933
934              The VM normally determines the number  of  available  processors
935              from  the  operating system.  This flag can be useful for parti‐
936              tioning CPU resources when running multiple  Java  processes  in
937              docker  containers.   This flag is honored even if UseContainer‐
938              Support is not enabled.  See -XX:-UseContainerSupport for a  de‐
939              scription of enabling and disabling container support.
940
941       -XX:AllocateHeapAt=path
942              Takes a path to the file system and uses memory mapping to allo‐
943              cate the object heap on the memory device.   Using  this  option
944              enables  the  HotSpot  VM to allocate the Java object heap on an
945              alternative memory device, such as an NV-DIMM, specified by  the
946              user.
947
948              Alternative memory devices that have the same semantics as DRAM,
949              including the semantics of atomic operations, can  be  used  in‐
950              stead  of DRAM for the object heap without changing the existing
951              application code.  All other memory structures (such as the code
952              heap, metaspace, and thread stacks) continue to reside in DRAM.
953
954              Some  operating  systems expose non-DRAM memory through the file
955              system.  Memory-mapped files in these file  systems  bypass  the
956              page cache and provide a direct mapping of virtual memory to the
957              physical memory on the device.  The existing heap related  flags
958              (such  as  -Xmx  and  -Xms) and garbage-collection related flags
959              continue to work as before.
960
961       -XX:-CompactStrings
962              Disables the Compact Strings feature.  By default,  this  option
963              is  enabled.  When this option is enabled, Java Strings contain‐
964              ing only single-byte characters are internally  represented  and
965              stored  as  single-byte-per-character Strings using ISO-8859-1 /
966              Latin-1 encoding.  This reduces, by 50%, the amount of space re‐
967              quired  for Strings containing only single-byte characters.  For
968              Java Strings containing at least one multibyte character:  these
969              are represented and stored as 2 bytes per character using UTF-16
970              encoding.  Disabling the Compact Strings feature forces the  use
971              of  UTF-16  encoding as the internal representation for all Java
972              Strings.
973
974              Cases where it may be beneficial to disable Compact Strings  in‐
975              clude the following:
976
977              · When it's known that an application overwhelmingly will be al‐
978                locating multibyte character Strings
979
980              · In the unexpected event where a performance regression is  ob‐
981                served  in migrating from Java SE 8 to Java SE 9 and an analy‐
982                sis shows that Compact Strings introduces the regression
983
984              In both of these  scenarios,  disabling  Compact  Strings  makes
985              sense.
986
987       -XX:ErrorFile=filename
988              Specifies  the path and file name to which error data is written
989              when an irrecoverable error occurs.  By default,  this  file  is
990              created  in  the current working directory and named hs_err_pid‐
991              pid.log where pid is the identifier of the process that  encoun‐
992              tered the error.
993
994              The  following  example  shows  how  to set the default log file
995              (note that the identifier of the process is specified as %p):
996
997                     -XX:ErrorFile=./hs_err_pid%p.log
998
999              · Oracle Solaris, Linux, and macOS: The following example  shows
1000                how to set the error log to /var/log/java/java_error.log:
1001
1002                       -XX:ErrorFile=/var/log/java/java_error.log
1003
1004              · Windows:  The following example shows how to set the error log
1005                file to C:/log/java/java_error.log:
1006
1007                       -XX:ErrorFile=C:/log/java/java_error.log
1008
1009              If the file exists, and is writeable, then it will be  overwrit‐
1010              ten.   Otherwise,  if the file can't be created in the specified
1011              directory (due to insufficient space, permission problem, or an‐
1012              other issue), then the file is created in the temporary directo‐
1013              ry for the operating system:
1014
1015              · Oracle Solaris, Linux, and macOS: The temporary  directory  is
1016                /tmp.
1017
1018              · Windows:  The temporary directory is specified by the value of
1019                the TMP environment variable;  if  that  environment  variable
1020                isn't defined, then the value of the TEMP environment variable
1021                is used.
1022
1023       -XX:+ExtensiveErrorReports
1024              Enables the reporting of more extensive error information in the
1025              ErrorFile.   This  option can be turned on in environments where
1026              maximal information is desired - even if the resulting logs  may
1027              be  quite large and/or contain information that might be consid‐
1028              ered sensitive.  The information can vary from  release  to  re‐
1029              lease,  and  across different platforms.  By default this option
1030              is disabled.
1031
1032       -XX:FlightRecorderOptions=parameter=value     (or)-XX:FlightRecorderOp‐
1033       tions:parameter=value
1034              Sets the parameters that control the behavior of JFR.
1035
1036              The  following  list  contains the available JFR parameter=value
1037              entries:
1038
1039              globalbuffersize=size
1040                     Specifies the total amount of primary memory used for da‐
1041                     ta  retention.   The  default value is based on the value
1042                     specified for memorysize.  Change the memorysize  parame‐
1043                     ter to alter the size of global buffers.
1044
1045              maxchunksize=size
1046                     Specifies  the maximum size (in bytes) of the data chunks
1047                     in a recording.  Append m or M to  specify  the  size  in
1048                     megabytes  (MB),  or  g or G to specify the size in giga‐
1049                     bytes (GB).  By default, the maximum size of data  chunks
1050                     is set to 12 MB.  The minimum allowed is 1 MB.
1051
1052              memorysize=size
1053                     Determines  how  much  buffer  memory should be used, and
1054                     sets the globalbuffersize and numglobalbuffers parameters
1055                     based  on  the  size specified.  Append m or M to specify
1056                     the size in megabytes (MB), or g or G to specify the size
1057                     in gigabytes (GB).  By default, the memory size is set to
1058                     10 MB.
1059
1060              numglobalbuffers
1061                     Specifies the number of global buffers used.  The default
1062                     value  is based on the memory size specified.  Change the
1063                     memorysize parameter to alter the number of  global  buf‐
1064                     fers.
1065
1066              old-object-queue-size=number-of-objects
1067                     Maximum  number of old objects to track.  By default, the
1068                     number of objects is set to 256.
1069
1070              repository=path
1071                     Specifies the repository (a directory) for temporary disk
1072                     storage.  By default, the system's temporary directory is
1073                     used.
1074
1075              retransform={true|false}
1076                     Specifies whether event classes should  be  retransformed
1077                     using  JVMTI.   If  false,  instrumentation is added when
1078                     event classes are loaded.  By default, this parameter  is
1079                     enabled.
1080
1081              samplethreads={true|false}
1082                     Specifies  whether  thread  sampling  is enabled.  Thread
1083                     sampling occurs only if the  sampling  event  is  enabled
1084                     along with this parameter.  By default, this parameter is
1085                     enabled.
1086
1087              stackdepth=depth
1088                     Stack depth for stack traces.  By default, the  depth  is
1089                     set  to  64  method  calls.  The maximum is 2048.  Values
1090                     greater than 64 could create significant overhead and re‐
1091                     duce performance.
1092
1093              threadbuffersize=size
1094                     Specifies  the  per-thread  local buffer size (in bytes).
1095                     By default, the local buffer size is set to 8  kilobytes,
1096                     with a minimum value of 4 kilobytes.  Overriding this pa‐
1097                     rameter could reduce performance and is not recommended.
1098
1099              You can specify values for  multiple  parameters  by  separating
1100              them with a comma.
1101
1102       -XX:LargePageSizeInBytes=size
1103              Sets  the  maximum  size (in bytes) for large pages used for the
1104              Java heap.  The size argument must be a power of 2 (2, 4, 8, 16,
1105              and  so  on).  Append the letter k or K to indicate kilobytes, m
1106              or M to indicate megabytes, or g or G to indicate gigabytes.  By
1107              default,  the size is set to 0, meaning that the JVM chooses the
1108              size for large pages automatically.  See Large Pages.
1109
1110              The following example describes how to set the large  page  size
1111              to 4 megabytes (MB):
1112
1113                     -XX:LargePageSizeInBytes=4m
1114
1115       -XX:MaxDirectMemorySize=size
1116              Sets  the maximum total size (in bytes) of the java.nio package,
1117              direct-buffer allocations.  Append the letter k or K to indicate
1118              kilobytes,  m  or M to indicate megabytes, or g or G to indicate
1119              gigabytes.  By default, the size is set to 0, meaning  that  the
1120              JVM chooses the size for NIO direct-buffer allocations automati‐
1121              cally.
1122
1123              The following examples illustrate how to set  the  NIO  size  to
1124              1024 KB in different units:
1125
1126                     -XX:MaxDirectMemorySize=1m
1127                     -XX:MaxDirectMemorySize=1024k
1128                     -XX:MaxDirectMemorySize=1048576
1129
1130       -XX:-MaxFDLimit
1131              Disables  the  attempt  to  set the soft limit for the number of
1132              open file descriptors to the hard limit.  By default,  this  op‐
1133              tion  is  enabled  on  all platforms, but is ignored on Windows.
1134              The only time that you may need to disable this is  on  Mac  OS,
1135              where  its  use  imposes a maximum of 10240, which is lower than
1136              the actual system maximum.
1137
1138       -XX:NativeMemoryTracking=mode
1139              Specifies the mode for tracking JVM native memory usage.  Possi‐
1140              ble mode arguments for this option include the following:
1141
1142              off    Instructs  not to track JVM native memory usage.  This is
1143                     the default behavior if you don't specify the -XX:Native‐
1144                     MemoryTracking option.
1145
1146              summary
1147                     Tracks  memory usage only by JVM subsystems, such as Java
1148                     heap, class, code, and thread.
1149
1150              detail In addition to tracking memory usage by  JVM  subsystems,
1151                     track  memory  usage  by  individual CallSite, individual
1152                     virtual memory region and its committed regions.
1153
1154       -XX:ObjectAlignmentInBytes=alignment
1155              Sets the memory alignment of Java objects (in  bytes).   By  de‐
1156              fault,  the value is set to 8 bytes.  The specified value should
1157              be a power of 2, and must be within the range of 8 and 256  (in‐
1158              clusive).   This  option  makes  it  possible  to use compressed
1159              pointers with large Java heap sizes.
1160
1161              The heap size limit in bytes is calculated as:
1162
1163                     4GB * ObjectAlignmentInBytes
1164
1165                     Note: As the alignment value increases, the unused  space
1166                     between objects also increases.  As a result, you may not
1167                     realize any benefits from using compressed pointers  with
1168                     large Java heap sizes.
1169
1170       -XX:OnError=string
1171              Sets  a  custom  command or a series of semicolon-separated com‐
1172              mands to run when an irrecoverable error occurs.  If the  string
1173              contains spaces, then it must be enclosed in quotation marks.
1174
1175              · Oracle  Solaris, Linux, and macOS: The following example shows
1176                how the -XX:OnError option can be used to run the  gcore  com‐
1177                mand to create a core image, and start the gdb debugger to at‐
1178                tach to the process in case of an irrecoverable error (the  %p
1179                designates the current process identifier):
1180
1181                       -XX:OnError="gcore %p;gdb -p %p"
1182
1183              · Windows:  The  following example shows how the -XX:OnError op‐
1184                tion can be used to run the userdump.exe utility to  obtain  a
1185                crash  dump  in  case of an irrecoverable error (the %p desig‐
1186                nates the current process identifier).  This  example  assumes
1187                that  the path to the userdump.exe utility is specified in the
1188                PATH environment variable:
1189
1190                       -XX:OnError="userdump.exe %p"
1191
1192       -XX:OnOutOfMemoryError=string
1193              Sets a custom command or a series  of  semicolon-separated  com‐
1194              mands to run when an OutOfMemoryError exception is first thrown.
1195              If the string contains spaces, then it must be enclosed in  quo‐
1196              tation  marks.   For an example of a command string, see the de‐
1197              scription of the -XX:OnError option.
1198
1199       -XX:+PrintCommandLineFlags
1200              Enables printing of ergonomically selected JVM  flags  that  ap‐
1201              peared  on  the  command line.  It can be useful to know the er‐
1202              gonomic values set by the JVM, such as the heap space  size  and
1203              the selected garbage collector.  By default, this option is dis‐
1204              abled and flags aren't printed.
1205
1206       -XX:+PreserveFramePointer
1207              Selects between using the RBP register as a general purpose reg‐
1208              ister  (-XX:-PreserveFramePointer) and using the RBP register to
1209              hold  the  frame  pointer  of  the  currently  executing  method
1210              (-XX:+PreserveFramePointer .  If the frame pointer is available,
1211              then external profiling tools (for example, Linux perf) can con‐
1212              struct more accurate stack traces.
1213
1214       -XX:+PrintNMTStatistics
1215              Enables printing of collected native memory tracking data at JVM
1216              exit when native memory tracking is enabled (see -XX:NativeMemo‐
1217              ryTracking).   By  default,  this  option is disabled and native
1218              memory tracking data isn't printed.
1219
1220       -XX:SharedArchiveFile=path
1221              Specifies the path and name of the class data sharing (CDS)  ar‐
1222              chive file
1223
1224              See Application Class Data Sharing.
1225
1226       -XX:SharedArchiveConfigFile=shared_config_file
1227              Specifies additional shared data added to the archive file.
1228
1229       -XX:SharedClassListFile=file_name
1230              Specifies  the  text file that contains the names of the classes
1231              to store in the class data sharing  (CDS)  archive.   This  file
1232              contains the full name of one class per line, except slashes (/)
1233              replace dots (.).  For  example,  to  specify  the  classes  ja‐
1234              va.lang.Object  and hello.Main, create a text file that contains
1235              the following two lines:
1236
1237                     java/lang/Object
1238                     hello/Main
1239
1240              The classes that you specify in this text  file  should  include
1241              the classes that are commonly used by the application.  They may
1242              include any classes from the application,  extension,  or  boot‐
1243              strap class paths.
1244
1245              See Application Class Data Sharing.
1246
1247       -XX:+ShowCodeDetailsInExceptionMessages
1248              Enables  printing  of  improved  NullPointerException  messages.
1249              When an application throws a  NullPointerException,  the  option
1250              enables  the  JVM to analyze the program's bytecode instructions
1251              to determine precisely which reference is  null,  and  describes
1252              the  source with a null-detail message.  The null-detail message
1253              is calculated and returned by NullPointerException.getMessage(),
1254              and  will  be  printed  as  the exception message along with the
1255              method, filename, and line number.  By default, this  option  is
1256              disabled.
1257
1258       -XX:+ShowMessageBoxOnError
1259              Enables  the display of a dialog box when the JVM experiences an
1260              irrecoverable error.  This prevents the  JVM  from  exiting  and
1261              keeps the process active so that you can attach a debugger to it
1262              to investigate the cause of the error.  By default, this  option
1263              is disabled.
1264
1265       -XX:StartFlightRecording=parameter=value
1266              Starts a JFR recording for the Java application.  This option is
1267              equivalent to the JFR.start diagnostic  command  that  starts  a
1268              recording  during  runtime.   You  can set the following parame‐
1269              ter=value entries when starting a JFR recording:
1270
1271              delay=time
1272                     Specifies the delay between the Java  application  launch
1273                     time and the start of the recording.  Append s to specify
1274                     the time in seconds, m for minutes, h for hours, or d for
1275                     days  (for example, specifying 10m means 10 minutes).  By
1276                     default, there's no delay, and this parameter is  set  to
1277                     0.
1278
1279              disk={true|false}
1280                     Specifies  whether to write data to disk while recording.
1281                     By default, this parameter is enabled.
1282
1283              dumponexit={true|false}
1284                     Specifies if the running recording is dumped when the JVM
1285                     shuts  down.   If  enabled and a filename is not entered,
1286                     the recording is written to a file in the directory where
1287                     the  process was started.  The file name is a system-gen‐
1288                     erated name that contains the process ID,  recording  ID,
1289                     and       current       timestamp,       similar       to
1290                     hotspot-pid-47496-id-1-2018_01_25_19_10_41.jfr.   By  de‐
1291                     fault, this parameter is disabled.
1292
1293              duration=time
1294                     Specifies  the  duration  of  the recording.  Append s to
1295                     specify the time in seconds, m for minutes, h for  hours,
1296                     or d for days (for example, specifying 5h means 5 hours).
1297                     By default, the duration isn't limited, and this  parame‐
1298                     ter is set to 0.
1299
1300              filename=path
1301                     Specifies  the  path  and  name  of the file to which the
1302                     recording is written when the recording is  stopped,  for
1303                     example:
1304
1305                     · recording.jfr
1306
1307                     · /home/user/recordings/recording.jfr
1308
1309                     · c:\recordings\recording.jfr
1310
1311              name=identifier
1312                     Takes both the name and the identifier of a recording.
1313
1314              maxage=time
1315                     Specifies  the  maximum  age of disk data to keep for the
1316                     recording.  This parameter is valid only  when  the  disk
1317                     parameter  is  set to true.  Append s to specify the time
1318                     in seconds, m for minutes, h for hours,  or  d  for  days
1319                     (for  example,  specifying 30s means 30 seconds).  By de‐
1320                     fault, the maximum age isn't limited, and this  parameter
1321                     is set to 0s.
1322
1323              maxsize=size
1324                     Specifies  the  maximum  size  (in bytes) of disk data to
1325                     keep for the recording.  This  parameter  is  valid  only
1326                     when  the  disk parameter is set to true.  The value must
1327                     not be less than the value for the maxchunksize parameter
1328                     set  with  -XX:FlightRecorderOptions.   Append  m or M to
1329                     specify the size in megabytes, or g or G to  specify  the
1330                     size  in gigabytes.  By default, the maximum size of disk
1331                     data isn't limited, and this parameter is set to 0.
1332
1333              path-to-gc-roots={true|false}
1334                     Specifies whether to collect the path to garbage  collec‐
1335                     tion  (GC)  roots at the end of a recording.  By default,
1336                     this parameter is disabled.
1337
1338                     The path to GC roots is useful for finding memory  leaks,
1339                     but  collecting it is time-consuming.  Enable this option
1340                     only when you start a recording for an  application  that
1341                     you suspect has a memory leak.  If the settings parameter
1342                     is set to profile, the stack trace from where the  poten‐
1343                     tial  leaking object was allocated is included in the in‐
1344                     formation collected.
1345
1346              settings=path
1347                     Specifies the path and name of the  event  settings  file
1348                     (of type JFC).  By default, the default.jfc file is used,
1349                     which is located in JRE_HOME/lib/jfr.  This default  set‐
1350                     tings  file collects a predefined set of information with
1351                     low overhead, so it has minimal impact on performance and
1352                     can be used with recordings that run continuously.
1353
1354                     A  second  settings  file  is also provided, profile.jfc,
1355                     which provides more data than the default  configuration,
1356                     but  can  have more overhead and impact performance.  Use
1357                     this configuration for short periods of  time  when  more
1358                     information is needed.
1359
1360              You  can  specify  values  for multiple parameters by separating
1361              them with a comma.
1362
1363       -XX:ThreadStackSize=size
1364              Sets the Java thread stack size (in kilobytes).  Use of a  scal‐
1365              ing  suffix,  such as k, results in the scaling of the kilobytes
1366              value so that -XX:ThreadStackSize=1k sets the Java thread  stack
1367              size  to  1024*1024  bytes or 1 megabyte.  The default value de‐
1368              pends on the platform:
1369
1370              · Linux/x64 (64-bit): 1024 KB
1371
1372              · macOS (64-bit): 1024 KB
1373
1374              · Oracle Solaris (64-bit): 1024 KB
1375
1376              · Windows: The default value depends on virtual memory
1377
1378              The following examples show how to set the thread stack size  to
1379              1 megabyte in different units:
1380
1381                     -XX:ThreadStackSize=1k
1382                     -XX:ThreadStackSize=1024
1383
1384              This option is similar to -Xss.
1385
1386       -XX:-UseBiasedLocking
1387              Disables the use of biased locking.  Some applications with sig‐
1388              nificant amounts of uncontended synchronization may attain  sig‐
1389              nificant  speedups with this flag enabled, but applications with
1390              certain patterns of locking may see slowdowns.  .
1391
1392              By default, this option is enabled.
1393
1394       -XX:-UseCompressedOops
1395              Disables the use of compressed pointers.  By default,  this  op‐
1396              tion  is  enabled,  and compressed pointers are used.  This will
1397              automatically limit the maximum  ergonomically  determined  Java
1398              heap size to the maximum amount of memory that can be covered by
1399              compressed pointers.  By default this range is 32 GB.
1400
1401              With compressed oops enabled, object references are  represented
1402              as  32-bit  offsets  instead of 64-bit pointers, which typically
1403              increases performance when running  the  application  with  Java
1404              heap sizes smaller than the compressed oops pointer range.  This
1405              option works only for 64-bit JVMs.
1406
1407              It's possible to use compressed pointers with  Java  heap  sizes
1408              greater than 32 GB.  See the -XX:ObjectAlignmentInBytes option.
1409
1410       -XX:-UseContainerSupport
1411              The VM now provides automatic container detection support, which
1412              allows the VM to determine the amount of memory  and  number  of
1413              processors that are available to a Java process running in dock‐
1414              er containers.  It uses this information to allocate system  re‐
1415              sources.  This support is only available on Linux x64 platforms.
1416              If supported, the default for this flag is true,  and  container
1417              support  is  enabled  by  default.   It  can  be  disabled  with
1418              -XX:-UseContainerSupport.
1419
1420              Unified Logging is available to help to diagnose issues  related
1421              to this support.
1422
1423              Use  -Xlog:os+container=trace  for  maximum logging of container
1424              information.  See Enable Logging with the  JVM  Unified  Logging
1425              Framework for a description of using Unified Logging.
1426
1427       -XX:+UseHugeTLBFS
1428              Linux   only:  This  option  is  the  equivalent  of  specifying
1429              -XX:+UseLargePages.  This option is disabled by  default.   This
1430              option  pre-allocates  all  large pages up-front, when memory is
1431              reserved; consequently the JVM can't dynamically grow or  shrink
1432              large pages memory areas; see -XX:UseTransparentHugePages if you
1433              want this behavior.
1434
1435              See Large Pages.
1436
1437       -XX:+UseLargePages
1438              Enables the use of large page memory.  By default,  this  option
1439              is disabled and large page memory isn't used.
1440
1441              See Large Pages.
1442
1443       -XX:+UseTransparentHugePages
1444              Linux  only: Enables the use of large pages that can dynamically
1445              grow or shrink.  This option is disabled by  default.   You  may
1446              encounter  performance  problems  with transparent huge pages as
1447              the OS moves other pages around to create huge pages;  this  op‐
1448              tion is made available for experimentation.
1449
1450       -XX:+AllowUserSignalHandlers
1451              Enables  installation of signal handlers by the application.  By
1452              default, this option is disabled and the application  isn't  al‐
1453              lowed to install signal handlers.
1454
1455       -XX:VMOptionsFile=filename
1456              Allows  user  to  specify VM options in a file, for example, ja‐
1457              va -XX:VMOptionsFile=/var/my_vm_options HelloWorld.
1458

ADVANCED JIT COMPILER OPTIONS FOR JAVA

1460       These java options control the dynamic just-in-time  (JIT)  compilation
1461       performed by the Java HotSpot VM.
1462
1463       -XX:AllocateInstancePrefetchLines=lines
1464              Sets the number of lines to prefetch ahead of the instance allo‐
1465              cation pointer.  By default, the number of lines to prefetch  is
1466              set to 1:
1467
1468                     -XX:AllocateInstancePrefetchLines=1
1469
1470       -XX:AllocatePrefetchDistance=size
1471              Sets the size (in bytes) of the prefetch distance for object al‐
1472              location.  Memory about to be written with the value of new  ob‐
1473              jects  is  prefetched  up to this distance starting from the ad‐
1474              dress of the last allocated object.  Each Java  thread  has  its
1475              own allocation point.
1476
1477              Negative values denote that prefetch distance is chosen based on
1478              the platform.  Positive values are bytes  to  prefetch.   Append
1479              the  letter  k  or  K  to indicate kilobytes, m or M to indicate
1480              megabytes, or g or G to indicate gigabytes.  The  default  value
1481              is set to -1.
1482
1483              The  following example shows how to set the prefetch distance to
1484              1024 bytes:
1485
1486                     -XX:AllocatePrefetchDistance=1024
1487
1488       -XX:AllocatePrefetchInstr=instruction
1489              Sets the prefetch instruction to prefetch ahead of  the  alloca‐
1490              tion  pointer.  Possible values are from 0 to 3.  The actual in‐
1491              structions behind the values depend on  the  platform.   By  de‐
1492              fault, the prefetch instruction is set to 0:
1493
1494                     -XX:AllocatePrefetchInstr=0
1495
1496       -XX:AllocatePrefetchLines=lines
1497              Sets the number of cache lines to load after the last object al‐
1498              location by using the prefetch instructions  generated  in  com‐
1499              piled code.  The default value is 1 if the last allocated object
1500              was an instance, and 3 if it was an array.
1501
1502              The following example shows how to  set  the  number  of  loaded
1503              cache lines to 5:
1504
1505                     -XX:AllocatePrefetchLines=5
1506
1507       -XX:AllocatePrefetchStepSize=size
1508              Sets  the  step size (in bytes) for sequential prefetch instruc‐
1509              tions.  Append the letter k or K to indicate kilobytes, m  or  M
1510              to  indicate  megabytes,  g  or G to indicate gigabytes.  By de‐
1511              fault, the step size is set to 16 bytes:
1512
1513                     -XX:AllocatePrefetchStepSize=16
1514
1515       -XX:AllocatePrefetchStyle=style
1516              Sets the generated code style for  prefetch  instructions.   The
1517              style argument is an integer from 0 to 3:
1518
1519              0      Don't generate prefetch instructions.
1520
1521              1      Execute  prefetch  instructions  after  each  allocation.
1522                     This is the default setting.
1523
1524              2      Use the thread-local allocation  block  (TLAB)  watermark
1525                     pointer  to determine when prefetch instructions are exe‐
1526                     cuted.
1527
1528              3      Generate one prefetch instruction per cache line.
1529
1530       -XX:+BackgroundCompilation
1531              Enables background compilation.  This option is enabled  by  de‐
1532              fault.   To  disable  background compilation, specify -XX:-Back‐
1533              groundCompilation (this is equivalent to specifying -Xbatch).
1534
1535       -XX:CICompilerCount=threads
1536              Sets the number of compiler threads to use for compilation.   By
1537              default, the number of compiler threads is selected automatical‐
1538              ly depending on the number of CPUs and memory available for com‐
1539              piled  code.   The following example shows how to set the number
1540              of threads to 2:
1541
1542                     -XX:CICompilerCount=2
1543
1544       -XX:+UseDynamicNumberOfCompilerThreads
1545              Dynamically create compiler thread up to the limit specified  by
1546              -XX:CICompilerCount.  This option is enabled by default.
1547
1548       -XX:CompileCommand=command,method[,option]
1549              Specifies a command to perform on a method.  For example, to ex‐
1550              clude the indexOf() method of the String class from  being  com‐
1551              piled, use the following:
1552
1553                     -XX:CompileCommand=exclude,java/lang/String.indexOf
1554
1555              Note  that the full class name is specified, including all pack‐
1556              ages and subpackages separated  by  a  slash  (/).   For  easier
1557              cut-and-paste  operations,  it's also possible to use the method
1558              name format produced by the -XX:+PrintCompilation and  -XX:+Log‐
1559              Compilation options:
1560
1561                     -XX:CompileCommand=exclude,java.lang.String::indexOf
1562
1563              If  the method is specified without the signature, then the com‐
1564              mand is applied to all methods with the specified name.   Howev‐
1565              er,  you  can  also  specify  the signature of the method in the
1566              class file format.  In this case, you should enclose  the  argu‐
1567              ments in quotation marks, because otherwise the shell treats the
1568              semicolon as a command end.  For example, if you want to exclude
1569              only  the  indexOf(String) method of the String class from being
1570              compiled, use the following:
1571
1572                     -XX:CompileCommand="exclude,java/lang/String.index‐
1573                     Of,(Ljava/lang/String;)I"
1574
1575              You  can  also  use the asterisk (*) as a wildcard for class and
1576              method names.  For example, to exclude all indexOf() methods  in
1577              all classes from being compiled, use the following:
1578
1579                     -XX:CompileCommand=exclude,*.indexOf
1580
1581              The  commas and periods are aliases for spaces, making it easier
1582              to pass compiler commands through a shell.  You can  pass  argu‐
1583              ments  to  -XX:CompileCommand  using spaces as separators by en‐
1584              closing the argument in quotation marks:
1585
1586                     -XX:CompileCommand="exclude java/lang/String indexOf"
1587
1588              Note that after parsing the commands passed on the command  line
1589              using  the  -XX:CompileCommand  options,  the  JIT compiler then
1590              reads commands from the .hotspot_compiler  file.   You  can  add
1591              commands  to  this  file  or  specify a different file using the
1592              -XX:CompileCommandFile option.
1593
1594              To add several commands, either specify  the  -XX:CompileCommand
1595              option  multiple  times,  or separate each argument with the new
1596              line separator (\n).  The following commands are available:
1597
1598              break  Sets a breakpoint when debugging the JVM to stop  at  the
1599                     beginning of compilation of the specified method.
1600
1601              compileonly
1602                     Excludes  all  methods  from  compilation  except for the
1603                     specified method.  As an alternative,  you  can  use  the
1604                     -XX:CompileOnly  option,  which  lets you specify several
1605                     methods.
1606
1607              dontinline
1608                     Prevents inlining of the specified method.
1609
1610              exclude
1611                     Excludes the specified method from compilation.
1612
1613              help   Prints a help message for the -XX:CompileCommand option.
1614
1615              inline Attempts to inline the specified method.
1616
1617              log    Excludes compilation logging (with  the  -XX:+LogCompila‐
1618                     tion  option)  for  all  methods except for the specified
1619                     method.  By default, logging is performed  for  all  com‐
1620                     piled methods.
1621
1622              option Passes  a  JIT compilation option to the specified method
1623                     in place of the last argument (option).  The  compilation
1624                     option is set at the end, after the method name.  For ex‐
1625                     ample, to enable the  BlockLayoutByFrequency  option  for
1626                     the  append()  method  of the StringBuffer class, use the
1627                     following:
1628
1629                            -XX:CompileCommand=option,java/lang/String‐
1630                            Buffer.append,BlockLayoutByFrequency
1631
1632                     You  can  specify multiple compilation options, separated
1633                     by commas or spaces.
1634
1635              print  Prints generated assembler code after compilation of  the
1636                     specified method.
1637
1638              quiet  Instructs not to print the compile commands.  By default,
1639                     the commands that you specify with the -XX:CompileCommand
1640                     option are printed; for example, if you exclude from com‐
1641                     pilation the indexOf() method of the String  class,  then
1642                     the following is printed to standard output:
1643
1644                            CompilerOracle: exclude java/lang/String.indexOf
1645
1646                     You  can  suppress this by specifying the -XX:CompileCom‐
1647                     mand=quiet option  before  other  -XX:CompileCommand  op‐
1648                     tions.
1649
1650       -XX:CompileCommandFile=filename
1651              Sets the file from which JIT compiler commands are read.  By de‐
1652              fault, the .hotspot_compiler file is used to store commands per‐
1653              formed by the JIT compiler.
1654
1655              Each  line  in  the  command  file represents a command, a class
1656              name, and a method name for which the command is used.  For  ex‐
1657              ample,  this line prints assembly code for the toString() method
1658              of the String class:
1659
1660                     print java/lang/String toString
1661
1662              If you're using commands for the  JIT  compiler  to  perform  on
1663              methods, then see the -XX:CompileCommand option.
1664
1665       -XX:CompilerDirectivesFile=file
1666              Adds  directives from a file to the directives stack when a pro‐
1667              gram   starts.    See   Compiler   Control    [https://docs.ora
1668              cle.com/en/java/javase/12/vm/compiler-con‐
1669              trol1.html#GUID-94AD8194-786A-4F19-BFFF-278F8E237F3A].
1670
1671              The -XX:CompilerDirectivesFile option has to  be  used  together
1672              with the -XX:UnlockDiagnosticVMOptions option that unlocks diag‐
1673              nostic JVM options.
1674
1675       -XX:+CompilerDirectivesPrint
1676              Prints the directives stack when the program starts  or  when  a
1677              new directive is added.
1678
1679              The  -XX:+CompilerDirectivesPrint option has to be used together
1680              with the -XX:UnlockDiagnosticVMOptions option that unlocks diag‐
1681              nostic JVM options.
1682
1683       -XX:CompileOnly=methods
1684              Sets the list of methods (separated by commas) to which compila‐
1685              tion should be restricted.  Only the specified methods are  com‐
1686              piled.   Specify each method with the full class name (including
1687              the packages and subpackages).  For example, to compile only the
1688              length() method of the String class and the size() method of the
1689              List class, use the following:
1690
1691                     -XX:CompileOnly=java/lang/String.length,ja‐
1692                     va/util/List.size
1693
1694              Note  that the full class name is specified, including all pack‐
1695              ages and subpackages separated by a slash (/).  For  easier  cut
1696              and  paste operations, it's also possible to use the method name
1697              format produced by the -XX:+PrintCompilation and  -XX:+LogCompi‐
1698              lation options:
1699
1700                     -XX:CompileOnly=java.lang.String::length,ja‐
1701                     va.util.List::size
1702
1703              Although wildcards aren't supported, you can  specify  only  the
1704              class  or  package  name to compile all methods in that class or
1705              package, as well as specify just the method to  compile  methods
1706              with this name in any class:
1707
1708                     -XX:CompileOnly=java/lang/String
1709                     -XX:CompileOnly=java/lang
1710                     -XX:CompileOnly=.length
1711
1712       -XX:CompileThresholdScaling=scale
1713              Provides unified control of first compilation.  This option con‐
1714              trols when methods are first compiled for both  the  tiered  and
1715              the  nontiered  modes of operation.  The CompileThresholdScaling
1716              option has a floating point value between 0 and +Inf and  scales
1717              the  thresholds  corresponding  to the current mode of operation
1718              (both tiered and nontiered).  Setting CompileThresholdScaling to
1719              a  value less than 1.0 results in earlier compilation while val‐
1720              ues greater than 1.0 delay compilation.  Setting  CompileThresh‐
1721              oldScaling to 0 is equivalent to disabling compilation.
1722
1723       -XX:+DoEscapeAnalysis
1724              Enables  the  use of escape analysis.  This option is enabled by
1725              default.   To  disable  the  use  of  escape  analysis,  specify
1726              -XX:-DoEscapeAnalysis.
1727
1728       -XX:InitialCodeCacheSize=size
1729              Sets  the initial code cache size (in bytes).  Append the letter
1730              k or K to indicate kilobytes, m or M to indicate megabytes, or g
1731              or  G  to  indicate gigabytes.  The default value depends on the
1732              platform.  The initial code cache size shouldn't  be  less  than
1733              the  system's  minimal  memory page size.  The following example
1734              shows how to set the initial code cache size to 32 KB:
1735
1736                     -XX:InitialCodeCacheSize=32k
1737
1738       -XX:+Inline
1739              Enables method inlining.  This option is enabled by  default  to
1740              increase  performance.   To  disable  method  inlining,  specify
1741              -XX:-Inline.
1742
1743       -XX:InlineSmallCode=size
1744              Sets the maximum code size (in bytes) for already compiled meth‐
1745              ods  that  may be inlined.  Append the letter k or K to indicate
1746              kilobytes, m or M to indicate megabytes, or g or G  to  indicate
1747              gigabytes.   The  default  value  depends on the platform and on
1748              whether tiered compilation is enabled.  In the following example
1749              it is set to 1000 bytes:
1750
1751                     -XX:InlineSmallCode=1000
1752
1753       -XX:+LogCompilation
1754              Enables   logging  of  compilation  activity  to  a  file  named
1755              hotspot.log in the current working directory.  You can specify a
1756              different log file path and name using the -XX:LogFile option.
1757
1758              By  default,  this  option  is disabled and compilation activity
1759              isn't logged.  The -XX:+LogCompilation option has to be used to‐
1760              gether  with  the  -XX:UnlockDiagnosticVMOptions option that un‐
1761              locks diagnostic JVM options.
1762
1763              You can enable verbose diagnostic output with a message  printed
1764              to  the  console  every  time  a method is compiled by using the
1765              -XX:+PrintCompilation option.
1766
1767       -XX:FreqInlineSize=size
1768              Sets the maximum bytecode size (in bytes) of a hot method to  be
1769              inlined.  Append the letter k or K to indicate kilobytes, m or M
1770              to indicate megabytes, or g or G to indicate gigabytes.  The de‐
1771              fault  value  depends on the platform.  In the following example
1772              it is set to 325 bytes:
1773
1774                     -XX:FreqInlineSize=325
1775
1776       -XX:MaxInlineSize=size
1777              Sets the maximum bytecode size (in bytes) of a cold method to be
1778              inlined.  Append the letter k or K to indicate kilobytes, m or M
1779              to indicate megabytes, or g or G to indicate gigabytes.  By  de‐
1780              fault, the maximum bytecode size is set to 35 bytes:
1781
1782                     -XX:MaxInlineSize=35
1783
1784       -XX:MaxTrivialSize=size
1785              Sets the maximum bytecode size (in bytes) of a trivial method to
1786              be inlined.  Append the letter k or K to indicate  kilobytes,  m
1787              or M to indicate megabytes, or g or G to indicate gigabytes.  By
1788              default, the maximum bytecode size of a trivial method is set to
1789              6 bytes:
1790
1791                     -XX:MaxTrivialSize=6
1792
1793       -XX:MaxNodeLimit=nodes
1794              Sets the maximum number of nodes to be used during single method
1795              compilation.  By default the value depends on the  features  en‐
1796              abled.   In the following example the maximum number of nodes is
1797              set to 100,000:
1798
1799                     -XX:MaxNodeLimit=100000
1800
1801       -XX:NonNMethodCodeHeapSize=size
1802              Sets the size in bytes of the code segment containing  nonmethod
1803              code.
1804
1805              A nonmethod code segment containing nonmethod code, such as com‐
1806              piler buffers and the  bytecode  interpreter.   This  code  type
1807              stays  in  the  code  cache  forever.  This flag is used only if
1808              -XX:SegmentedCodeCache is enabled.
1809
1810       -XX:NonProfiledCodeHeapSize=size
1811              Sets the size in bytes of the code  segment  containing  nonpro‐
1812              filed methods.  This flag is used only if -XX:SegmentedCodeCache
1813              is enabled.
1814
1815       -XX:+OptimizeStringConcat
1816              Enables the optimization  of  String  concatenation  operations.
1817              This  option is enabled by default.  To disable the optimization
1818              of String concatenation operations, specify -XX:-OptimizeString‐
1819              Concat.
1820
1821       -XX:+PrintAssembly
1822              Enables printing of assembly code for bytecoded and native meth‐
1823              ods by using the external hsdis-<arch>.so or .dll library.   For
1824              64-bit  VM  on  Windows, it's hsdis-amd64.dll.  This lets you to
1825              see the generated code, which may help you to  diagnose  perfor‐
1826              mance issues.
1827
1828              By  default,  this  option  is  disabled and assembly code isn't
1829              printed.  The -XX:+PrintAssembly option has to be used  together
1830              with the -XX:UnlockDiagnosticVMOptions option that unlocks diag‐
1831              nostic JVM options.
1832
1833       -XX:ProfiledCodeHeapSize=size
1834              Sets the size in bytes of the code segment  containing  profiled
1835              methods.   This  flag  is used only if -XX:SegmentedCodeCache is
1836              enabled.
1837
1838       -XX:+PrintCompilation
1839              Enables verbose diagnostic output from the  JVM  by  printing  a
1840              message  to  the  console every time a method is compiled.  This
1841              lets you to see which methods actually  get  compiled.   By  de‐
1842              fault,  this  option  is  disabled  and  diagnostic output isn't
1843              printed.
1844
1845              You can also log compilation activity to a  file  by  using  the
1846              -XX:+LogCompilation option.
1847
1848       -XX:+PrintInlining
1849              Enables  printing  of  inlining  decisions.   This let's you see
1850              which methods are getting inlined.
1851
1852              By default, this option is  disabled  and  inlining  information
1853              isn't printed.  The -XX:+PrintInlining option has to be used to‐
1854              gether with the -XX:+UnlockDiagnosticVMOptions option  that  un‐
1855              locks diagnostic JVM options.
1856
1857       -XX:ReservedCodeCacheSize=size
1858              Sets  the  maximum  code  cache size (in bytes) for JIT-compiled
1859              code.  Append the letter k or K to indicate kilobytes, m or M to
1860              indicate  megabytes,  or  g or G to indicate gigabytes.  The de‐
1861              fault maximum code cache size is 240 MB; if you  disable  tiered
1862              compilation with the option -XX:-TieredCompilation, then the de‐
1863              fault size is 48 MB.  This option has a limit of  2  GB;  other‐
1864              wise,  an  error  is  generated.   The  maximum  code cache size
1865              shouldn't be less than the initial code cache size; see the  op‐
1866              tion -XX:InitialCodeCacheSize.
1867
1868       -XX:RTMAbortRatio=abort_ratio
1869              Specifies  the  RTM abort ratio is specified as a percentage (%)
1870              of all executed RTM transactions.  If a number of aborted trans‐
1871              actions  becomes greater than this ratio, then the compiled code
1872              is deoptimized.  This ratio is used  when  the  -XX:+UseRTMDeopt
1873              option  is  enabled.   The  default  value of this option is 50.
1874              This means that the compiled code is deoptimized if 50%  of  all
1875              transactions are aborted.
1876
1877       -XX:RTMRetryCount=number_of_retries
1878              Specifies  the  number of times that the RTM locking code is re‐
1879              tried, when it is aborted or busy, before falling  back  to  the
1880              normal  locking mechanism.  The default value for this option is
1881              5.  The -XX:UseRTMLocking option must be enabled.
1882
1883       -XX:+SegmentedCodeCache
1884              Enables segmentation of the code cache.  Without  the  -XX:+Seg‐
1885              mentedCodeCache,  the  code cache consists of one large segment.
1886              With -XX:+SegmentedCodeCache, we have separate segments for non‐
1887              method,  profiled  method,  and  nonprofiled method code.  These
1888              segments aren't resized at runtime.  The feature is  enabled  by
1889              default if tiered compilation is enabled (-XX:+TieredCompilation
1890              ) and -XX:ReservedCodeCacheSize >= 240 MB.  The  advantages  are
1891              better  control of the memory footprint, reduced code fragmenta‐
1892              tion, and better iTLB/iCache behavior due to improved  locality.
1893              iTLB/iCache  is a CPU-specific term meaning Instruction Transla‐
1894              tion Lookaside Buffer (ITLB).  ICache is an instruction cache in
1895              theCPU.   The  implementation  of the code cache can be found in
1896              the file: /share/vm/code/codeCache.cpp.
1897
1898       -XX:StartAggressiveSweepingAt=percent
1899              Forces stack scanning of active methods to  aggressively  remove
1900              unused  code when only the given percentage of the code cache is
1901              free.  The default value is 10%.
1902
1903       -XX:-TieredCompilation
1904              Disables the use of tiered compilation.  By default, this option
1905              is enabled.
1906
1907       -XX:UseSSE=version
1908              Enables  the  use of SSE instruction set of a specified version.
1909              Is set by default to the  highest  supported  version  available
1910              (x86 only).
1911
1912       -XX:UseAVX=version
1913              Enables  the  use of AVX instruction set of a specified version.
1914              Is set by default to the  highest  supported  version  available
1915              (x86 only).
1916
1917       -XX:+UseAES
1918              Enables hardware-based AES intrinsics for hardware that supports
1919              it.  This option is on by default on hardware that has the  nec‐
1920              essary  instructions.   The  -XX:+UseAES  is used in conjunction
1921              with UseAESIntrinsics.  Flags that control  intrinsics  now  re‐
1922              quire the option -XX:+UnlockDiagnosticVMOptions.
1923
1924       -XX:+UseAESIntrinsics
1925              Enables   AES  intrinsics.   Specifying-XX:+UseAESIntrinsics  is
1926              equivalent to  also  enabling  -XX:+UseAES.   To  disable  hard‐
1927              ware-based  AES  intrinsics,  specify -XX:-UseAES -XX:-UseAESIn‐
1928              trinsics.  For example, to enable hardware AES, use the  follow‐
1929              ing flags:
1930
1931                     -XX:+UseAES -XX:+UseAESIntrinsics
1932
1933              Flags  that  control  intrinsics now require the option -XX:+Un‐
1934              lockDiagnosticVMOptions.
1935
1936       -XX:+UseAESCTRIntrinsics
1937              Analogous to -XX:+UseAESIntrinsics enables AES/CTR intrinsics.
1938
1939       -XX:+UseGHASHIntrinsics
1940              Controls the use of GHASH intrinsics.   Enabled  by  default  on
1941              platforms  that  support  the corresponding instructions.  Flags
1942              that control intrinsics now require the option  -XX:+UnlockDiag‐
1943              nosticVMOptions.
1944
1945       -XX:+UseBASE64Intrinsics
1946              Controls the use of accelerated BASE64 encoding routines for ja‐
1947              va.util.Base64.  Enabled by default on  platforms  that  support
1948              it.   Flags  that  control  intrinsics  now  require  the option
1949              -XX:+UnlockDiagnosticVMOptions.
1950
1951       -XX:+UseAdler32Intrinsics
1952              Controls the use of Adler32 checksum algorithm intrinsic for ja‐
1953              va.util.zip.Adler32.   Enabled by default on platforms that sup‐
1954              port it.  Flags that control intrinsics now require  the  option
1955              -XX:+UnlockDiagnosticVMOptions.
1956
1957       -XX:+UseCRC32Intrinsics
1958              Controls  the  use  of CRC32 intrinsics for java.util.zip.CRC32.
1959              Enabled by default on platforms that  support  it.   Flags  that
1960              control  intrinsics  now  require the option -XX:+UnlockDiagnos‐
1961              ticVMOptions.
1962
1963       -XX:+UseCRC32CIntrinsics
1964              Controls the use of CRC32C intrinsics for  java.util.zip.CRC32C.
1965              Enabled  by  default  on  platforms that support it.  Flags that
1966              control intrinsics now require  the  option  -XX:+UnlockDiagnos‐
1967              ticVMOptions.
1968
1969       -XX:+UseSHA
1970              Enables  hardware-based intrinsics for SHA crypto hash functions
1971              for SPARC hardware.  The UseSHA option is  used  in  conjunction
1972              with   the   UseSHA1Intrinsics,  UseSHA256Intrinsics,  and  Use‐
1973              SHA512Intrinsics options.
1974
1975              The UseSHA and UseSHA*Intrinsics flags are enabled by default on
1976              machines that support the corresponding instructions.
1977
1978              This  feature  is  applicable  only  when  using the sun.securi‐
1979              ty.provider.Sun provider for SHA operations.  Flags that control
1980              intrinsics  now  require  the  option -XX:+UnlockDiagnosticVMOp‐
1981              tions.
1982
1983              To  disable  all  hardware-based  SHA  intrinsics,  specify  the
1984              -XX:-UseSHA.   To  disable  only a particular SHA intrinsic, use
1985              the appropriate corresponding option.   For  example:  -XX:-Use‐
1986              SHA256Intrinsics.
1987
1988       -XX:+UseSHA1Intrinsics
1989              Enables  intrinsics  for SHA-1 crypto hash function.  Flags that
1990              control intrinsics now require  the  option  -XX:+UnlockDiagnos‐
1991              ticVMOptions.
1992
1993       -XX:+UseSHA256Intrinsics
1994              Enables  intrinsics  for  SHA-224  and SHA-256 crypto hash func‐
1995              tions.  Flags that control intrinsics  now  require  the  option
1996              -XX:+UnlockDiagnosticVMOptions.
1997
1998       -XX:+UseSHA512Intrinsics
1999              Enables  intrinsics  for  SHA-384  and SHA-512 crypto hash func‐
2000              tions.  Flags that control intrinsics  now  require  the  option
2001              -XX:+UnlockDiagnosticVMOptions.
2002
2003       -XX:+UseMathExactIntrinsics
2004              Enables   intrinsification  of  various  java.lang.Math.*Exact()
2005              functions.  Enabled by default.  Flags that  control  intrinsics
2006              now require the option -XX:+UnlockDiagnosticVMOptions.
2007
2008       -XX:+UseMultiplyToLenIntrinsic
2009              Enables intrinsification of BigInteger.multiplyToLen().  Enabled
2010              by default on platforms that support it.  Flags that control in‐
2011              trinsics now require the option -XX:+UnlockDiagnosticVMOptions.
2012
2013       -XX:+UseSquareToLenIntrinsic
2014              Enables  intrinsification  of BigInteger.squareToLen().  Enabled
2015              by default on platforms that support it.  Flags that control in‐
2016              trinsics now require the option -XX:+UnlockDiagnosticVMOptions.
2017
2018       -XX:+UseMulAddIntrinsic
2019              Enables intrinsification of BigInteger.mulAdd().  Enabled by de‐
2020              fault on platforms that support it.  Flags that control  intrin‐
2021              sics now require the option -XX:+UnlockDiagnosticVMOptions.
2022
2023       -XX:+UseMontgomeryMultiplyIntrinsic
2024              Enables   intrinsification  of  BigInteger.montgomeryMultiply().
2025              Enabled by default on platforms that  support  it.   Flags  that
2026              control  intrinsics  now  require the option -XX:+UnlockDiagnos‐
2027              ticVMOptions.
2028
2029       -XX:+UseMontgomerySquareIntrinsic
2030              Enables intrinsification of BigInteger.montgomerySquare().   En‐
2031              abled  by default on platforms that support it.  Flags that con‐
2032              trol intrinsics now require the  option  -XX:+UnlockDiagnosticV‐
2033              MOptions.
2034
2035       -XX:+UseCMoveUnconditionally
2036              Generates  CMove  (scalar and vector) instructions regardless of
2037              profitability analysis.
2038
2039       -XX:+UseCodeCacheFlushing
2040              Enables flushing of the code cache before shutting down the com‐
2041              piler.   This option is enabled by default.  To disable flushing
2042              of the code cache before shutting  down  the  compiler,  specify
2043              -XX:-UseCodeCacheFlushing.
2044
2045       -XX:+UseCondCardMark
2046              Enables  checking  if the card is already marked before updating
2047              the card table.  This option is disabled by default.  It  should
2048              be  used  only  on  machines with multiple sockets, where it in‐
2049              creases the performance of Java applications that rely  on  con‐
2050              current operations.
2051
2052       -XX:+UseCountedLoopSafepoints
2053              Keeps safepoints in counted loops.  Its default value depends on
2054              whether the selected  garbage  collector  requires  low  latency
2055              safepoints.
2056
2057       -XX:LoopStripMiningIter=number_of_iterations
2058              Controls the number of iterations in the inner strip mined loop.
2059              Strip mining transforms counted  loops  into  two  level  nested
2060              loops.   Safepoints  are  kept in the outer loop while the inner
2061              loop can execute at full speed.  This option controls the  maxi‐
2062              mum  number  of iterations in the inner loop.  The default value
2063              is 1,000.
2064
2065       -XX:LoopStripMiningIterShortLoop=number_of_iterations
2066              Controls loop strip mining optimization.  Loops with the  number
2067              of  iterations  less  than specified will not have safepoints in
2068              them.  Default value is 1/10th of -XX:LoopStripMiningIter.
2069
2070       -XX:+UseFMA
2071              Enables hardware-based FMA intrinsics for hardware where FMA in‐
2072              structions  are  available  (such  as, Intel, SPARC, and ARM64).
2073              FMA intrinsics are generated for the java.lang.Math.fma(a, b, c)
2074              methods that calculate the value of ( a * b + c ) expressions.
2075
2076       -XX:+UseRTMDeopt
2077              Autotunes  RTM locking depending on the abort ratio.  This ratio
2078              is specified by the -XX:RTMAbortRatio option.  If the number  of
2079              aborted  transactions  exceeds  the abort ratio, then the method
2080              containing the lock is deoptimized and recompiled with all locks
2081              as  normal  locks.   This  option  is  disabled by default.  The
2082              -XX:+UseRTMLocking option must be enabled.
2083
2084       -XX:+UseRTMLocking
2085              Generates Restricted Transactional Memory (RTM) locking code for
2086              all  inflated  locks,  with  the normal locking mechanism as the
2087              fallback handler.  This option is disabled by default.   Options
2088              related  to  RTM  are  available  only  on x86 CPUs that support
2089              Transactional Synchronization Extensions (TSX).
2090
2091              RTM is part of Intel's TSX, which is an x86 instruction set  ex‐
2092              tension  and  facilitates the creation of multithreaded applica‐
2093              tions.  RTM introduces  the  new  instructions  XBEGIN,  XABORT,
2094              XEND, and XTEST.  The XBEGIN and XEND instructions enclose a set
2095              of instructions to run as a  transaction.   If  no  conflict  is
2096              found when running the transaction, then the memory and register
2097              modifications are committed together at  the  XEND  instruction.
2098              The  XABORT instruction can be used to explicitly abort a trans‐
2099              action and the XEND instruction checks if a set of  instructions
2100              is being run in a transaction.
2101
2102              A lock on a transaction is inflated when another thread tries to
2103              access the same transaction, thereby blocking  the  thread  that
2104              didn't  originally  request  access to the transaction.  RTM re‐
2105              quires that a fallback set of operations be specified in case  a
2106              transaction  aborts  or  fails.   An RTM lock is a lock that has
2107              been delegated to the TSX's system.
2108
2109              RTM improves performance for highly  contended  locks  with  low
2110              conflict  in  a  critical region (which is code that must not be
2111              accessed by more than one thread concurrently).   RTM  also  im‐
2112              proves  the performance of coarse-grain locking, which typically
2113              doesn't   perform   well    in    multithreaded    applications.
2114              (Coarse-grain  locking is the strategy of holding locks for long
2115              periods to minimize the overhead of taking and releasing  locks,
2116              while  fine-grained locking is the strategy of trying to achieve
2117              maximum parallelism by locking only when necessary and unlocking
2118              as soon as possible.) Also, for lightly contended locks that are
2119              used by different threads, RTM can reduce false cache line shar‐
2120              ing,  also known as cache line ping-pong.  This occurs when mul‐
2121              tiple threads from different processors are accessing  different
2122              resources,  but  the  resources share the same cache line.  As a
2123              result, the processors repeatedly invalidate the cache lines  of
2124              other processors, which forces them to read from main memory in‐
2125              stead of their cache.
2126
2127       -XX:+UseSuperWord
2128              Enables the transformation of scalar operations  into  superword
2129              operations.   Superword  is  a vectorization optimization.  This
2130              option is enabled by default.  To disable the transformation  of
2131              scalar operations into superword operations, specify -XX:-UseSu‐
2132              perWord.
2133

ADVANCED SERVICEABILITY OPTIONS FOR JAVA

2135       These java options provide the ability to gather system information and
2136       perform extensive debugging.
2137
2138       -XX:+DisableAttachMechanism
2139              Disables  the  mechanism  that lets tools attach to the JVM.  By
2140              default, this option is disabled, meaning that the attach mecha‐
2141              nism  is enabled and you can use diagnostics and troubleshooting
2142              tools such as jcmd, jstack, jmap, and jinfo.
2143
2144                     Note: The tools such as jcmd,  jinfo,  jmap,  and  jstack
2145                     shipped  with  the  JDK  aren't  supported when using the
2146                     tools from one JDK version to  troubleshoot  a  different
2147                     JDK version.
2148
2149       -XX:+ExtendedDTraceProbes
2150              Oracle Solaris, Linux, and macOS: Enables additional dtrace tool
2151              probes that affect the performance.  By default, this option  is
2152              disabled and dtrace performs only standard probes.
2153
2154       -XX:+HeapDumpOnOutOfMemoryError
2155              Enables  the  dumping  of the Java heap to a file in the current
2156              directory  by  using  the  heap  profiler  (HPROF)  when  a  ja‐
2157              va.lang.OutOfMemoryError exception is thrown.  You can explicit‐
2158              ly set the heap dump file path and name using the  -XX:HeapDump‐
2159              Path  option.   By default, this option is disabled and the heap
2160              isn't dumped when an OutOfMemoryError exception is thrown.
2161
2162       -XX:HeapDumpPath=path
2163              Sets the path and file name for writing the heap  dump  provided
2164              by  the heap profiler (HPROF) when the -XX:+HeapDumpOnOutOfMemo‐
2165              ryError option is set.  By default, the file is created  in  the
2166              current  working  directory,  and it's named java_pid<pid>.hprof
2167              where <pid> is the identifier of the process that caused the er‐
2168              ror.   The  following  example shows how to set the default file
2169              explicitly (%p represents the current process identifier):
2170
2171                     -XX:HeapDumpPath=./java_pid%p.hprof
2172
2173              · Oracle Solaris, Linux, and macOS: The following example  shows
2174                how  to  set  the  heap  dump file to /var/log/java/java_heap‐
2175                dump.hprof:
2176
2177                       -XX:HeapDumpPath=/var/log/java/java_heapdump.hprof
2178
2179              · Windows: The following example shows how to set the heap  dump
2180                file to C:/log/java/java_heapdump.log:
2181
2182                       -XX:HeapDumpPath=C:/log/java/java_heapdump.log
2183
2184       -XX:LogFile=path
2185              Sets  the  path  and file name to where log data is written.  By
2186              default, the file is created in the current  working  directory,
2187              and it's named hotspot.log.
2188
2189              · Oracle  Solaris, Linux, and macOS: The following example shows
2190                how to set the log file to /var/log/java/hotspot.log:
2191
2192                       -XX:LogFile=/var/log/java/hotspot.log
2193
2194              · Windows: The following example shows how to set the  log  file
2195                to C:/log/java/hotspot.log:
2196
2197                       -XX:LogFile=C:/log/java/hotspot.log
2198
2199       -XX:+PrintClassHistogram
2200              Enables  printing of a class instance histogram after one of the
2201              following events:
2202
2203              · Oracle Solaris, Linux, and macOS: Control+Break
2204
2205              · Windows: Control+C (SIGTERM)
2206
2207              By default, this option is disabled.
2208
2209              Setting this option is equivalent  to  running  the  jmap -histo
2210              command,  or  the jcmd pid GC.class_histogram command, where pid
2211              is the current Java process identifier.
2212
2213       -XX:+PrintConcurrentLocks
2214              Enables printing of java.util.concurrent locks after one of  the
2215              following events:
2216
2217              · Oracle Solaris, Linux, and macOS: Control+Break
2218
2219              · Windows: Control+C (SIGTERM)
2220
2221              By default, this option is disabled.
2222
2223              Setting  this option is equivalent to running the jstack -l com‐
2224              mand or the jcmd pid Thread.print -l command, where pid  is  the
2225              current Java process identifier.
2226
2227       -XX:+PrintFlagsRanges
2228              Prints  the  range specified and allows automatic testing of the
2229              values.  See Validate Java Virtual Machine Flag Arguments.
2230
2231       -XX:+PerfDataSaveToFile
2232              If enabled, saves jstat binary data when  the  Java  application
2233              exits.   This  binary  data  is  saved in a file named hsperfda‐
2234              ta_pid, where pid is the process identifier of the Java applica‐
2235              tion that you ran.  Use the jstat command to display the perfor‐
2236              mance data contained in this file as follows:
2237
2238                     jstat -class file:///path/hsperfdata_pid
2239
2240                     jstat -gc file:///path/hsperfdata_pid
2241
2242       -XX:+UsePerfData
2243              Enables the perfdata feature.  This option is enabled by default
2244              to  allow  JVM monitoring and performance testing.  Disabling it
2245              suppresses the creation of  the  hsperfdata_userid  directories.
2246              To disable the perfdata feature, specify -XX:-UsePerfData.
2247

ADVANCED GARBAGE COLLECTION OPTIONS FOR JAVA

2249       These  java options control how garbage collection (GC) is performed by
2250       the Java HotSpot VM.
2251
2252       -XX:+AggressiveHeap
2253              Enables Java heap optimization.  This sets various parameters to
2254              be  optimal  for long-running jobs with intensive memory alloca‐
2255              tion, based on the configuration of the computer (RAM and  CPU).
2256              By  default,  the option is disabled and the heap sizes are con‐
2257              figured less aggressively.
2258
2259       -XX:+AlwaysPreTouch
2260              Requests the VM to touch every page on the Java heap  after  re‐
2261              questing  it from the operating system and before handing memory
2262              out to the application.  By default, this option is disabled and
2263              all pages are committed as the application uses the heap space.
2264
2265       -XX:ConcGCThreads=threads
2266              Sets the number of threads used for concurrent GC.  Sets threads
2267              to approximately 1/4 of the number of parallel  garbage  collec‐
2268              tion  threads.   The default value depends on the number of CPUs
2269              available to the JVM.
2270
2271              For example, to set the number of threads for concurrent  GC  to
2272              2, specify the following option:
2273
2274                     -XX:ConcGCThreads=2
2275
2276       -XX:+DisableExplicitGC
2277              Enables the option that disables processing of calls to the Sys‐
2278              tem.gc() method.  This option is disabled  by  default,  meaning
2279              that calls to System.gc() are processed.  If processing of calls
2280              to System.gc() is disabled, then the JVM still performs GC  when
2281              necessary.
2282
2283       -XX:+ExplicitGCInvokesConcurrent
2284              Enables  invoking  of concurrent GC by using the System.gc() re‐
2285              quest.  This option is disabled by default and  can  be  enabled
2286              only with the -XX:+UseG1GC option.
2287
2288       -XX:G1AdaptiveIHOPNumInitialSamples=number
2289              When -XX:UseAdaptiveIHOP is enabled, this option sets the number
2290              of completed marking cycles used  to  gather  samples  until  G1
2291              adaptively determines the optimum value of -XX:InitiatingHeapOc‐
2292              cupancyPercent.  Before,  G1  uses  the  value  of  -XX:Initiat‐
2293              ingHeapOccupancyPercent  directly for this purpose.  The default
2294              value is 3.
2295
2296       -XX:G1HeapRegionSize=size
2297              Sets the size of the regions into which the Java heap is  subdi‐
2298              vided when using the garbage-first (G1) collector.  The value is
2299              a power of 2 and can range from 1 MB to 32 MB.  The default  re‐
2300              gion  size  is  determined  ergonomically based on the heap size
2301              with a goal of approximately 2048 regions.
2302
2303              The following example sets the size of the  subdivisions  to  16
2304              MB:
2305
2306                     -XX:G1HeapRegionSize=16m
2307
2308       -XX:G1HeapWastePercent=percent
2309              Sets  the  percentage of heap that you're willing to waste.  The
2310              Java HotSpot VM doesn't initiate the  mixed  garbage  collection
2311              cycle  when  the  reclaimable  percentage  is less than the heap
2312              waste percentage.  The default is 5 percent.
2313
2314       -XX:G1MaxNewSizePercent=percent
2315              Sets the percentage of the heap size to use as the  maximum  for
2316              the  young  generation size.  The default value is 60 percent of
2317              your Java heap.
2318
2319              This is an experimental flag.  This setting replaces the -XX:De‐
2320              faultMaxNewGenPercent setting.
2321
2322       -XX:G1MixedGCCountTarget=number
2323              Sets  the  target  number  of  mixed garbage collections after a
2324              marking cycle to collect old  regions  with  at  most  G1MixedG‐
2325              CLIveThresholdPercent live data.  The default is 8 mixed garbage
2326              collections.  The goal for mixed collections  is  to  be  within
2327              this target number.
2328
2329       -XX:G1MixedGCLiveThresholdPercent=percent
2330              Sets the occupancy threshold for an old region to be included in
2331              a mixed garbage collection cycle.  The default occupancy  is  85
2332              percent.
2333
2334              This  is  an  experimental  flag.   This  setting  replaces  the
2335              -XX:G1OldCSetRegionLiveThresholdPercent setting.
2336
2337       -XX:G1NewSizePercent=percent
2338              Sets the percentage of the heap to use as the  minimum  for  the
2339              young  generation  size.  The default value is 5 percent of your
2340              Java heap.
2341
2342              This is an experimental flag.  This setting replaces the -XX:De‐
2343              faultMinNewGenPercent setting.
2344
2345       -XX:G1OldCSetRegionThresholdPercent=percent
2346              Sets an upper limit on the number of old regions to be collected
2347              during a mixed garbage collection cycle.  The default is 10 per‐
2348              cent of the Java heap.
2349
2350       -XX:G1ReservePercent=percent
2351              Sets  the  percentage of the heap (0 to 50) that's reserved as a
2352              false ceiling to reduce the possibility of promotion failure for
2353              the G1 collector.  When you increase or decrease the percentage,
2354              ensure that you adjust the total Java heap by the  same  amount.
2355              By default, this option is set to 10%.
2356
2357              The following example sets the reserved heap to 20%:
2358
2359                     -XX:G1ReservePercent=20
2360
2361       -XX:+G1UseAdaptiveIHOP
2362              Controls adaptive calculation of the old generation occupancy to
2363              start background work preparing for an  old  generation  collec‐
2364              tion.   If  enabled,  G1 uses -XX:InitiatingHeapOccupancyPercent
2365              for the first few times as specified by the value of -XX:G1Adap‐
2366              tiveIHOPNumInitialSamples,  and after that adaptively calculates
2367              a new optimum value for the initiating occupancy  automatically.
2368              Otherwise,  the  old generation collection process always starts
2369              at the  old  generation  occupancy  determined  by  -XX:Initiat‐
2370              ingHeapOccupancyPercent.
2371
2372              The default is enabled.
2373
2374       -XX:InitialHeapSize=size
2375              Sets  the initial size (in bytes) of the memory allocation pool.
2376              This value must be either 0, or a multiple of 1024  and  greater
2377              than 1 MB.  Append the letter k or K to indicate kilobytes, m or
2378              M to indicate megabytes, or g or G to indicate  gigabytes.   The
2379              default  value  is selected at run time based on the system con‐
2380              figuration.
2381
2382              The following examples show how to set  the  size  of  allocated
2383              memory to 6 MB using various units:
2384
2385                     -XX:InitialHeapSize=6291456
2386                     -XX:InitialHeapSize=6144k
2387                     -XX:InitialHeapSize=6m
2388
2389              If you set this option to 0, then the initial size is set as the
2390              sum of the sizes allocated for the old generation and the  young
2391              generation.   The  size of the heap for the young generation can
2392              be set using the -XX:NewSize option.
2393
2394       -XX:InitialRAMPercentage=percent
2395              Sets the initial amount of memory that the JVM will use for  the
2396              Java  heap before applying ergonomics heuristics as a percentage
2397              of the maximum amount determined as described in the  -XX:MaxRAM
2398              option.  The default value is 1.5625 percent.
2399
2400              The  following  example  shows  how to set the percentage of the
2401              initial amount of memory used for the Java heap:
2402
2403                     -XX:InitialRAMPercentage=5
2404
2405       -XX:InitialSurvivorRatio=ratio
2406              Sets the initial survivor space ratio  used  by  the  throughput
2407              garbage  collector  (which  is enabled by the -XX:+UseParallelGC
2408              and/or -XX:+UseParallelOldGC options).  Adaptive sizing  is  en‐
2409              abled  by default with the throughput garbage collector by using
2410              the -XX:+UseParallelGC and  -XX:+UseParallelOldGC  options,  and
2411              the  survivor  space is resized according to the application be‐
2412              havior, starting with the initial value.  If adaptive sizing  is
2413              disabled (using the -XX:-UseAdaptiveSizePolicy option), then the
2414              -XX:SurvivorRatio option should be used to set the size  of  the
2415              survivor space for the entire execution of the application.
2416
2417              The  following formula can be used to calculate the initial size
2418              of survivor space (S) based on the size of the young  generation
2419              (Y), and the initial survivor space ratio (R):
2420
2421                     S=Y/(R+2)
2422
2423              The  2  in the equation denotes two survivor spaces.  The larger
2424              the value specified as the initial  survivor  space  ratio,  the
2425              smaller the initial survivor space size.
2426
2427              By  default,  the  initial survivor space ratio is set to 8.  If
2428              the default value for the young generation space size is used (2
2429              MB), then the initial size of the survivor space is 0.2 MB.
2430
2431              The  following  example  shows  how  to set the initial survivor
2432              space ratio to 4:
2433
2434                     -XX:InitialSurvivorRatio=4
2435
2436       -XX:InitiatingHeapOccupancyPercent=percent
2437              Sets the percentage of the old generation occupancy (0  to  100)
2438              at  which  to  start the first few concurrent marking cycles for
2439              the G1 garbage collector.
2440
2441              By default, the initiating value is set to 45%.  A  value  of  0
2442              implies nonstop concurrent GC cycles from the beginning until G1
2443              adaptively sets this value.
2444
2445              See also the -XX:G1UseAdaptiveIHOP and -XX:G1AdaptiveIHOPNumIni‐
2446              tialSamples options.
2447
2448              The following example shows how to set the initiating heap occu‐
2449              pancy to 75%:
2450
2451                     -XX:InitiatingHeapOccupancyPercent=75
2452
2453       -XX:MaxGCPauseMillis=time
2454              Sets a target for the maximum GC pause time  (in  milliseconds).
2455              This  is  a  soft goal, and the JVM will make its best effort to
2456              achieve it.  The specified value  doesn't  adapt  to  your  heap
2457              size.   By  default, for G1 the maximum pause time target is 200
2458              milliseconds.  The other generational collectors do  not  use  a
2459              pause time goal by default.
2460
2461              The  following example shows how to set the maximum target pause
2462              time to 500 ms:
2463
2464                     -XX:MaxGCPauseMillis=500
2465
2466       -XX:MaxHeapSize=size
2467              Sets the maximum size (in byes) of the memory  allocation  pool.
2468              This  value  must  be  a multiple of 1024 and greater than 2 MB.
2469              Append the letter k or K to indicate kilobytes, m or M to  indi‐
2470              cate  megabytes,  or  g or G to indicate gigabytes.  The default
2471              value is selected at run time based on the system configuration.
2472              For  server  deployments,  the  options  -XX:InitialHeapSize and
2473              -XX:MaxHeapSize are often set to the same value.
2474
2475              The following examples show how to set the maximum allowed  size
2476              of allocated memory to 80 MB using various units:
2477
2478                     -XX:MaxHeapSize=83886080
2479                     -XX:MaxHeapSize=81920k
2480                     -XX:MaxHeapSize=80m
2481
2482              The -XX:MaxHeapSize option is equivalent to -Xmx.
2483
2484       -XX:MaxHeapFreeRatio=percent
2485              Sets  the  maximum  allowed  percentage of free heap space (0 to
2486              100) after a GC event.  If free heap space  expands  above  this
2487              value,  then  the heap is shrunk.  By default, this value is set
2488              to 70%.
2489
2490              Minimize the Java heap size by lowering the values of the param‐
2491              eters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRa‐
2492              tio  (default  value  is  40%)  with  the  command-line  options
2493              -XX:MaxHeapFreeRatio  and  -XX:MinHeapFreeRatio.   Lowering Max‐
2494              HeapFreeRatio to as low as 10% and MinHeapFreeRatio  to  5%  has
2495              successfully  reduced the heap size without too much performance
2496              regression; however, results may vary greatly depending on  your
2497              application.   Try  different  values for these parameters until
2498              they're as low as possible yet still retain  acceptable  perfor‐
2499              mance.
2500
2501                     -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5
2502
2503              Customers  trying to keep the heap small should also add the op‐
2504              tion -XX:-ShrinkHeapInSteps.  See  Performance  Tuning  Examples
2505              for  a  description  of  using this option to keep the Java heap
2506              small by reducing the dynamic footprint  for  embedded  applica‐
2507              tions.
2508
2509       -XX:MaxMetaspaceSize=size
2510              Sets  the  maximum amount of native memory that can be allocated
2511              for class metadata.  By default, the size  isn't  limited.   The
2512              amount of metadata for an application depends on the application
2513              itself, other running applications, and  the  amount  of  memory
2514              available on the system.
2515
2516              The following example shows how to set the maximum class metada‐
2517              ta size to 256 MB:
2518
2519                     -XX:MaxMetaspaceSize=256m
2520
2521       -XX:MaxNewSize=size
2522              Sets the maximum size (in bytes) of the heap for the young  gen‐
2523              eration (nursery).  The default value is set ergonomically.
2524
2525       -XX:MaxRAM=size
2526              Sets  the  maximum amount of memory that the JVM may use for the
2527              Java heap before applying ergonomics  heuristics.   The  default
2528              value  is  the  maximum  amount  of  available memory to the JVM
2529              process or 128 GB, whichever is lower.
2530
2531              The maximum amount of available memory to the JVM process is the
2532              minimum of the machine's physical memory and any constraints set
2533              by the environment (e.g.  container).
2534
2535              Specifying this option disables automatic use of compressed oops
2536              if the combined result of this and other options influencing the
2537              maximum amount of memory is larger than the range of memory  ad‐
2538              dressable  by  compressed  oops.   See -XX:UseCompressedOops for
2539              further information about compressed oops.
2540
2541              The following example shows how to set  the  maximum  amount  of
2542              available memory for sizing the Java heap to 2 GB:
2543
2544                     -XX:MaxRAM=2G
2545
2546       -XX:MaxRAMPercentage=percent
2547              Sets  the  maximum amount of memory that the JVM may use for the
2548              Java heap before applying ergonomics heuristics as a  percentage
2549              of  the maximum amount determined as described in the -XX:MaxRAM
2550              option.  The default value is 25 percent.
2551
2552              Specifying this option disables automatic use of compressed oops
2553              if the combined result of this and other options influencing the
2554              maximum amount of memory is larger than the range of memory  ad‐
2555              dressable  by  compressed  oops.   See -XX:UseCompressedOops for
2556              further information about compressed oops.
2557
2558              The following example shows how to set  the  percentage  of  the
2559              maximum amount of memory used for the Java heap:
2560
2561                     -XX:MaxRAMPercentage=75
2562
2563       -XX:MinRAMPercentage=percent
2564              Sets  the  maximum amount of memory that the JVM may use for the
2565              Java heap before applying ergonomics heuristics as a  percentage
2566              of  the maximum amount determined as described in the -XX:MaxRAM
2567              option for small heaps.  A small heap is a heap of approximately
2568              125 MB.  The default value is 50 percent.
2569
2570              The  following  example  shows  how to set the percentage of the
2571              maximum amount of memory used for the Java heap for small heaps:
2572
2573                     -XX:MinRAMPercentage=75
2574
2575       -XX:MaxTenuringThreshold=threshold
2576              Sets the maximum tenuring threshold for use in adaptive GC  siz‐
2577              ing.   The largest value is 15.  The default value is 15 for the
2578              parallel (throughput) collector.
2579
2580              The following example shows how  to  set  the  maximum  tenuring
2581              threshold to 10:
2582
2583                     -XX:MaxTenuringThreshold=10
2584
2585       -XX:MetaspaceSize=size
2586              Sets  the  size of the allocated class metadata space that trig‐
2587              gers a garbage collection the first time  it's  exceeded.   This
2588              threshold for a garbage collection is increased or decreased de‐
2589              pending on the amount of metadata used.  The  default  size  de‐
2590              pends on the platform.
2591
2592       -XX:MinHeapFreeRatio=percent
2593              Sets  the  minimum  allowed  percentage of free heap space (0 to
2594              100) after a GC event.  If free heap space falls below this val‐
2595              ue, then the heap is expanded.  By default, this value is set to
2596              40%.
2597
2598              Minimize Java heap size by lowering the values of the parameters
2599              MaxHeapFreeRatio  (default  value  is  70%) and MinHeapFreeRatio
2600              (default value is 40%) with the  command-line  options  -XX:Max‐
2601              HeapFreeRatio and -XX:MinHeapFreeRatio.  Lowering MaxHeapFreeRa‐
2602              tio to as low as 10% and MinHeapFreeRatio to 5% has successfully
2603              reduced  the  heap size without too much performance regression;
2604              however, results may vary greatly depending on your application.
2605              Try  different  values for these parameters until they're as low
2606              as possible, yet still retain acceptable performance.
2607
2608                     -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5
2609
2610              Customers trying to keep the heap small should also add the  op‐
2611              tion  -XX:-ShrinkHeapInSteps.   See  Performance Tuning Examples
2612              for a description of using this option to  keep  the  Java  heap
2613              small  by  reducing  the dynamic footprint for embedded applica‐
2614              tions.
2615
2616       -XX:MinHeapSize=size
2617              Sets the minimum size (in bytes) of the memory allocation  pool.
2618              This  value  must be either 0, or a multiple of 1024 and greater
2619              than 1 MB.  Append the letter k or K to indicate kilobytes, m or
2620              M  to  indicate megabytes, or g or G to indicate gigabytes.  The
2621              default value is selected at run time based on the  system  con‐
2622              figuration.
2623
2624              The following examples show how to set the mimimum size of allo‐
2625              cated memory to 6 MB using various units:
2626
2627                     -XX:MinHeapSize=6291456
2628                     -XX:MinHeapSize=6144k
2629                     -XX:MinHeapSize=6m
2630
2631              If you set this option to 0, then the minimum size is set to the
2632              same value as the initial size.
2633
2634       -XX:NewRatio=ratio
2635              Sets  the  ratio between young and old generation sizes.  By de‐
2636              fault, this option is set to 2.  The following example shows how
2637              to set the young-to-old ratio to 1:
2638
2639                     -XX:NewRatio=1
2640
2641       -XX:NewSize=size
2642              Sets  the initial size (in bytes) of the heap for the young gen‐
2643              eration (nursery).  Append the letter k or K to  indicate  kilo‐
2644              bytes, m or M to indicate megabytes, or g or G to indicate giga‐
2645              bytes.
2646
2647              The young generation region of the heap is used for new objects.
2648              GC is performed in this region more often than in other regions.
2649              If the size for the young generation is too low,  then  a  large
2650              number  of  minor  GCs  are performed.  If the size is too high,
2651              then only full GCs are performed, which can take a long time  to
2652              complete.   It  is  recommended  that  you keep the size for the
2653              young generation greater than 25% and less than 50% of the over‐
2654              all heap size.
2655
2656              The  following  examples show how to set the initial size of the
2657              young generation to 256 MB using various units:
2658
2659                     -XX:NewSize=256m
2660                     -XX:NewSize=262144k
2661                     -XX:NewSize=268435456
2662
2663              The -XX:NewSize option is equivalent to -Xmn.
2664
2665       -XX:ParallelGCThreads=threads
2666              Sets the number of the stop-the-world (STW) worker threads.  The
2667              default value depends on the number of CPUs available to the JVM
2668              and the garbage collector selected.
2669
2670              For example, to set the number of threads for G1 GC to 2, speci‐
2671              fy the following option:
2672
2673                     -XX:ParallelGCThreads=2
2674
2675       -XX:+ParallelRefProcEnabled
2676              Enables  parallel reference processing.  By default, this option
2677              is disabled.
2678
2679       -XX:+PrintAdaptiveSizePolicy
2680              Enables printing of information about  adaptive-generation  siz‐
2681              ing.  By default, this option is disabled.
2682
2683       -XX:+ScavengeBeforeFullGC
2684              Enables  GC  of  the young generation before each full GC.  This
2685              option is enabled by default.  It is recommended that you  don't
2686              disable  it,  because  scavenging  the young generation before a
2687              full GC can reduce the number of objects reachable from the  old
2688              generation space into the young generation space.  To disable GC
2689              of the young generation before each full GC, specify the  option
2690              -XX:-ScavengeBeforeFullGC.
2691
2692       -XX:SoftRefLRUPolicyMSPerMB=time
2693              Sets the amount of time (in milliseconds) a softly reachable ob‐
2694              ject is kept active on the heap after the last time it was  ref‐
2695              erenced.   The  default value is one second of lifetime per free
2696              megabyte in the heap.   The  -XX:SoftRefLRUPolicyMSPerMB  option
2697              accepts   integer   values  representing  milliseconds  per  one
2698              megabyte of the current heap size (for Java HotSpot  Client  VM)
2699              or  the maximum possible heap size (for Java HotSpot Server VM).
2700              This difference means that the Client VM  tends  to  flush  soft
2701              references  rather  than  grow  the  heap, whereas the Server VM
2702              tends to grow the heap rather than flush  soft  references.   In
2703              the  latter case, the value of the -Xmx option has a significant
2704              effect on how quickly soft references are garbage collected.
2705
2706              The following example shows how to set the value to 2.5 seconds:
2707
2708              -XX:SoftRefLRUPolicyMSPerMB=2500
2709
2710       -XX:-ShrinkHeapInSteps
2711              Incrementally reduces the Java heap to the target  size,  speci‐
2712              fied by the option -XX:MaxHeapFreeRatio.  This option is enabled
2713              by default.  If disabled, then it immediately reduces  the  Java
2714              heap  to  the  target size instead of requiring multiple garbage
2715              collection cycles.  Disable this option if you want to  minimize
2716              the  Java  heap  size.   You  will  likely encounter performance
2717              degradation when this option is disabled.
2718
2719              See Performance Tuning Examples for a description of  using  the
2720              MaxHeapFreeRatio  option to keep the Java heap small by reducing
2721              the dynamic footprint for embedded applications.
2722
2723       -XX:StringDeduplicationAgeThreshold=threshold
2724              Identifies String objects reaching the specified  age  that  are
2725              considered  candidates  for deduplication.  An object's age is a
2726              measure of how many times it has  survived  garbage  collection.
2727              This is sometimes referred to as tenuring.
2728
2729                     Note: String objects that are promoted to an old heap re‐
2730                     gion before this age has been reached are always  consid‐
2731                     ered candidates for deduplication.  The default value for
2732                     this option is 3.   See  the  -XX:+UseStringDeduplication
2733                     option.
2734
2735       -XX:SurvivorRatio=ratio
2736              Sets  the ratio between eden space size and survivor space size.
2737              By default, this option is set  to  8.   The  following  example
2738              shows how to set the eden/survivor space ratio to 4:
2739
2740                     -XX:SurvivorRatio=4
2741
2742       -XX:TargetSurvivorRatio=percent
2743              Sets  the  desired  percentage of survivor space (0 to 100) used
2744              after young garbage collection.  By default, this option is  set
2745              to 50%.
2746
2747              The following example shows how to set the target survivor space
2748              ratio to 30%:
2749
2750                     -XX:TargetSurvivorRatio=30
2751
2752       -XX:TLABSize=size
2753              Sets the initial size (in bytes) of  a  thread-local  allocation
2754              buffer  (TLAB).  Append the letter k or K to indicate kilobytes,
2755              m or M to indicate megabytes, or g or G to  indicate  gigabytes.
2756              If  this  option  is  set to 0, then the JVM selects the initial
2757              size automatically.
2758
2759              The following example shows how to set the initial TLAB size  to
2760              512 KB:
2761
2762                     -XX:TLABSize=512k
2763
2764       -XX:+UseAdaptiveSizePolicy
2765              Enables  the  use of adaptive generation sizing.  This option is
2766              enabled by default.   To  disable  adaptive  generation  sizing,
2767              specify -XX:-UseAdaptiveSizePolicy and set the size of the memo‐
2768              ry allocation pool explicitly.  See  the  -XX:SurvivorRatio  op‐
2769              tion.
2770
2771       -XX:+UseG1GC
2772              Enables  the  use  of  the garbage-first (G1) garbage collector.
2773              It's a server-style garbage collector, targeted for multiproces‐
2774              sor  machines  with a large amount of RAM.  This option meets GC
2775              pause time goals with high probability, while  maintaining  good
2776              throughput.   The  G1  collector is recommended for applications
2777              requiring large heaps (sizes of around 6 GB or larger) with lim‐
2778              ited  GC  latency  requirements  (a stable and predictable pause
2779              time below 0.5 seconds).  By default, this option is enabled and
2780              G1 is used as the default garbage collector.
2781
2782       -XX:+UseGCOverheadLimit
2783              Enables  the  use of a policy that limits the proportion of time
2784              spent by the JVM on GC before an OutOfMemoryError  exception  is
2785              thrown.  This option is enabled, by default, and the parallel GC
2786              will throw an OutOfMemoryError if more than  98%  of  the  total
2787              time is spent on garbage collection and less than 2% of the heap
2788              is recovered.  When the heap is small, this feature can be  used
2789              to  prevent  applications  from running for long periods of time
2790              with little or no progress.  To disable this option, specify the
2791              option -XX:-UseGCOverheadLimit.
2792
2793       -XX:+UseNUMA
2794              Enables  performance optimization of an application on a machine
2795              with nonuniform memory architecture (NUMA) by increasing the ap‐
2796              plication's  use  of lower latency memory.  By default, this op‐
2797              tion is disabled and no optimization for NUMA is made.  The  op‐
2798              tion  is  available  only when the parallel garbage collector is
2799              used (-XX:+UseParallelGC).
2800
2801       -XX:+UseParallelGC
2802              Enables the use of the parallel scavenge garbage collector (also
2803              known as the throughput collector) to improve the performance of
2804              your application by leveraging multiple processors.
2805
2806              By default, this option is disabled and the default collector is
2807              used.  If it's enabled, then the -XX:+UseParallelOldGC option is
2808              automatically enabled, unless you explicitly disable it.
2809
2810       -XX:+UseSerialGC
2811              Enables the use of the serial garbage collector.  This is gener‐
2812              ally  the  best  choice  for  small and simple applications that
2813              don't require any special functionality from garbage collection.
2814              By default, this option is disabled and the default collector is
2815              used.
2816
2817       -XX:+UseSHM
2818              Linux only: Enables the JVM to use shared memory to set up large
2819              pages.
2820
2821              See Large Pages for setting up large pages.
2822
2823       -XX:+UseStringDeduplication
2824              Enables  string  deduplication.  By default, this option is dis‐
2825              abled.  To use this option, you must  enable  the  garbage-first
2826              (G1) garbage collector.
2827
2828              String  deduplication reduces the memory footprint of String ob‐
2829              jects on the Java heap by taking advantage of the fact that many
2830              String  objects  are  identical.   Instead of each String object
2831              pointing to its own character array,  identical  String  objects
2832              can point to and share the same character array.
2833
2834       -XX:+UseTLAB
2835              Enables the use of thread-local allocation blocks (TLABs) in the
2836              young generation space.  This option is enabled by default.   To
2837              disable the use of TLABs, specify the option -XX:-UseTLAB.
2838
2839       -XX:+UseZGC
2840              Enables  the  use of the Z garbage collector.  This garbage col‐
2841              lector is best for providing  lowest  latency  with  large  Java
2842              heaps  at some throughput cost.  This is an experimental garbage
2843              collector, you need to specify  -XX:+UnlockExperimentalVMOptions
2844              before -XX:+UseZGC on the command line.
2845
2846              Example:
2847
2848                     -XX:+UnlockExperimentalVMOptions -XX:+UseZGC
2849

DEPRECATED JAVA OPTIONS

2851       These  java options are deprecated and might be removed in a future JDK
2852       release.  They're still accepted and acted upon, but a warning  is  is‐
2853       sued when they're used.
2854
2855       -Xfuture
2856              Enables  strict class-file format checks that enforce close con‐
2857              formance to the  class-file  format  specification.   Developers
2858              should  use this flag when developing new code.  Stricter checks
2859              may become the default in future releases.
2860
2861       -Xloggc:filename
2862              Sets the file to which verbose GC events information  should  be
2863              redirected  for  logging.   The  -Xloggc  option overrides -ver‐
2864              bose:gc if both are given with the same  java  command.   -Xlog‐
2865              gc:filename  is  replaced by -Xlog:gc:filename.  See Enable Log‐
2866              ging with the JVM Unified Logging Framework.
2867
2868              Example:
2869
2870              -Xlog:gc:garbage-collection.log
2871
2872       -XX:+FlightRecorder
2873              Enables the use of Java Flight Recorder (JFR) during the runtime
2874              of the application.  Since JDK 8u40 this option has not been re‐
2875              quired to use JFR.
2876
2877       -XX:InitialRAMFraction=ratio
2878              Sets the initial amount of memory that the JVM may use  for  the
2879              Java  heap  before  applying ergonomics heuristics as a ratio of
2880              the maximum amount determined as described in the -XX:MaxRAM op‐
2881              tion.  The default value is 64.
2882
2883              Use the option -XX:InitialRAMPercentage instead.
2884
2885       -XX:MaxRAMFraction=ratio
2886              Sets  the  maximum amount of memory that the JVM may use for the
2887              Java heap before applying ergonomics heuristics as a fraction of
2888              the maximum amount determined as described in the -XX:MaxRAM op‐
2889              tion.  The default value is 4.
2890
2891              Specifying this option disables automatic use of compressed oops
2892              if the combined result of this and other options influencing the
2893              maximum amount of memory is larger than the range of memory  ad‐
2894              dressable  by  compressed  oops.   See -XX:UseCompressedOops for
2895              further information about compressed oops.
2896
2897              Use the option -XX:MaxRAMPercentage instead.
2898
2899       -XX:MinRAMFraction=ratio
2900              Sets the maximum amount of memory that the JVM may use  for  the
2901              Java heap before applying ergonomics heuristics as a fraction of
2902              the maximum amount determined as described in the -XX:MaxRAM op‐
2903              tion  for  small heaps.  A small heap is a heap of approximately
2904              125 MB.  The default value is 2.
2905
2906              Use the option -XX:MinRAMPercentage instead.
2907
2908       -XX:+TraceClassLoading
2909              Enables tracing of classes as they are loaded.  By default, this
2910              option is disabled and classes aren't traced.
2911
2912              The  replacement Unified Logging syntax is -Xlog:class+load=lev‐
2913              el.  See Enable Logging with the JVM Unified Logging Framework
2914
2915              Use level=info for regular information, or level=debug for addi‐
2916              tional  information.   In Unified Logging syntax, -verbose:class
2917              equals -Xlog:class+load=info,class+unload=info.
2918
2919       -XX:+TraceClassLoadingPreorder
2920              Enables tracing of all loaded classes  in  the  order  in  which
2921              they're  referenced.   By  default,  this option is disabled and
2922              classes aren't traced.
2923
2924              The  replacement  Unified  Logging  syntax  is  -Xlog:class+pre‐
2925              order=debug.   See  Enable  Logging with the JVM Unified Logging
2926              Framework.
2927
2928       -XX:+TraceClassResolution
2929              Enables tracing of constant pool resolutions.  By default,  this
2930              option is disabled and constant pool resolutions aren't traced.
2931
2932              The   replacement  Unified  Logging  syntax  is  -Xlog:class+re‐
2933              solve=debug.  See Enable Logging with the  JVM  Unified  Logging
2934              Framework.
2935
2936       -XX:+TraceLoaderConstraints
2937              Enables  tracing  of  the  loader constraints recording.  By de‐
2938              fault, this option is disabled and loader constraints  recording
2939              isn't traced.
2940
2941              The  replacement  Unified  Logging  syntax  is -Xlog:class+load‐
2942              er+constraints=info.  See Enable Logging with  the  JVM  Unified
2943              Logging Framework.
2944
2945       -XX:+UseParallelOldGC
2946              Enables  the use of the parallel garbage collector for full GCs.
2947              By default, this option is disabled.  Enabling it  automatically
2948              enables the -XX:+UseParallelGC option.
2949

OBSOLETE JAVA OPTIONS

2951       These java options are still accepted but ignored, and a warning is is‐
2952       sued when they're used.
2953
2954       -XX:+FailOverToOldVerifier
2955              Enables automatic failover to the old verifier when the new type
2956              checker fails.  By default, this option is disabled and it's ig‐
2957              nored (that is, treated as disabled) for classes with  a  recent
2958              bytecode version.  You can enable it only for classes with older
2959              versions of the bytecode.
2960
2961       -XX:+UseMembar
2962              Enabled issuing membars on thread-state transitions.   This  op‐
2963              tion  was  disabled  by  default  on  all  platforms  except ARM
2964              servers, where it was enabled.
2965
2966       -XX:MaxPermSize=size
2967              Sets the maximum permanent generation  space  size  (in  bytes).
2968              This  option  was  deprecated  in  JDK  8  and superseded by the
2969              -XX:MaxMetaspaceSize option.
2970
2971       -XX:PermSize=size
2972              Sets the space (in bytes) allocated to the permanent  generation
2973              that  triggers  a garbage collection if it's exceeded.  This op‐
2974              tion was deprecated in JDK 8 and superseded  by  the  -XX:Metas‐
2975              paceSize option.
2976

REMOVED JAVA OPTIONS

2978       No documented java options have been removed in JDK 14.
2979
2980       For  the lists and descriptions of options removed in previous releases
2981       see the Removed Java Options section in:
2982
2983       · Java  Platform,  Standard  Edition  Tools   Reference,   Release   13
2984         [https://docs.oracle.com/en/java/javase/13/docs/specs/man/java.html]
2985
2986       · Java   Platform,   Standard   Edition  Tools  Reference,  Release  12
2987         [https://docs.oracle.com/en/java/javase/12/tools/ja
2988         va.html#GUID-3B1CE181-CD30-4178-9602-230B800D4FAE]
2989
2990       · Java   Platform,   Standard   Edition  Tools  Reference,  Release  11
2991         [https://docs.oracle.com/en/java/javase/11/tools/ja
2992         va.html#GUID-741FC470-AA3E-494A-8D2B-1B1FE4A990D1]
2993
2994       · Java   Platform,   Standard   Edition  Tools  Reference,  Release  10
2995         [https://docs.oracle.com/javase/10/tools/java.htm#JSWOR624]
2996
2997       · Java  Platform,  Standard  Edition   Tools   Reference,   Release   9
2998         [https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624]
2999
3000       · Java Platform, Standard Edition Tools Reference, Release 8 for Oracle
3001         JDK    on    Windows     [https://docs.oracle.com/javase/8/docs/tech
3002         notes/tools/windows/java.html#BGBCIEFC]
3003
3004       · Java Platform, Standard Edition Tools Reference, Release 8 for Oracle
3005         JDK    on    Solaris,    Linux,    and    macOS    [https://docs.ora
3006         cle.com/javase/8/docs/technotes/tools/unix/java.html#BGBCIEFC]
3007

JAVA COMMAND-LINE ARGUMENT FILES

3009       You  can shorten or simplify the java command by using @ argument files
3010       to specify one or more text files that contain arguments, such  as  op‐
3011       tions  and  class  names,  which  are passed to the java command.  This
3012       let's you to create java commands of any length on any  operating  sys‐
3013       tem.
3014
3015       In the command line, use the at sign (@) prefix to identify an argument
3016       file that contains java options and class names.  When the java command
3017       encounters  a  file beginning with the at sign (@), it expands the con‐
3018       tents of that file into an argument list just as they would  be  speci‐
3019       fied on the command line.
3020
3021       The  java  launcher expands the argument file contents until it encoun‐
3022       ters the --disable-@files option.  You can use the --disable-@files op‐
3023       tion  anywhere  on  the command line, including in an argument file, to
3024       stop @ argument files expansion.
3025
3026       The following items describe the syntax of java argument files:
3027
3028       · The argument file must contain only ASCII characters or characters in
3029         system default encoding that's ASCII friendly, such as UTF-8.
3030
3031       · The argument file size must not exceed MAXINT (2,147,483,647) bytes.
3032
3033       · The  launcher doesn't expand wildcards that are present within an ar‐
3034         gument file.
3035
3036       · Use white space or new line characters to separate arguments included
3037         in the file.
3038
3039       · White space includes a white space character, \t, \n, \r, and \f.
3040
3041         For  example,  it  is  possible  to have a path with a space, such as
3042         c:\Program Files that can be specified as either  "c:\\Program Files"
3043         or, to avoid an escape, c:\Program" "Files.
3044
3045       · Any  option  that  contains spaces, such as a path component, must be
3046         within quotation marks using quotation ('"') characters  in  its  en‐
3047         tirety.
3048
3049       · A  string  within  quotation marks may contain the characters \n, \r,
3050         \t, and \f.  They are converted to their respective ASCII codes.
3051
3052       · If a file name contains embedded spaces, then put the whole file name
3053         in double quotation marks.
3054
3055       · File names in an argument file are relative to the current directory,
3056         not to the location of the argument file.
3057
3058       · Use the number sign # in the argument file to identify comments.  All
3059         characters following the # are ignored until the end of line.
3060
3061       · Additional at sign @ prefixes to @ prefixed options act as an escape,
3062         (the first @ is removed and the rest of the arguments  are  presented
3063         to the launcher literally).
3064
3065       · Lines  may  be  continued using the continuation character (\) at the
3066         end-of-line.  The two lines are concatenated with the  leading  white
3067         spaces trimmed.  To prevent trimming the leading white spaces, a con‐
3068         tinuation character (\) may be placed at the first column.
3069
3070       · Because backslash (\) is an escape character, a  backslash  character
3071         must be escaped with another backslash character.
3072
3073       · Partial quote is allowed and is closed by an end-of-file.
3074
3075       · An  open  quote  stops at end-of-line unless \ is the last character,
3076         which then joins the next line by removing all  leading  white  space
3077         characters.
3078
3079       · Wildcards (*) aren't allowed in these lists (such as specifying *.ja‐
3080         va).
3081
3082       · Use of the at sign (@) to recursively interpret files isn't  support‐
3083         ed.
3084
3085   Example of Open or Partial Quotes in an Argument File
3086       In the argument file,
3087
3088              -cp "lib/
3089              cool/
3090              app/
3091              jars
3092
3093       this is interpreted as:
3094
3095              -cp lib/cool/app/jars
3096
3097   Example of a Backslash Character Escaped with Another Backslash
3098       Character in an Argument File
3099
3100       To output the following:
3101
3102              -cp c:\Program Files (x86)\Java\jre\lib\ext;c:\Program Files\Ja‐
3103              va\jre9\lib\ext
3104
3105       The backslash character must be specified in the argument file as:
3106
3107              -cp "c:\\Program Files (x86)\\Java\\jre\\lib\\ext;c:\\Pro‐
3108              gram Files\\Java\\jre9\\lib\\ext"
3109
3110   Example of an EOL Escape Used to Force Concatenation of Lines in an
3111       Argument File
3112
3113       In the argument file,
3114
3115              -cp "/lib/cool app/jars:\
3116                  /lib/another app/jars"
3117
3118       This is interpreted as:
3119
3120              -cp /lib/cool app/jars:/lib/another app/jars
3121
3122   Example of Line Continuation with Leading Spaces in an Argument File
3123       In the argument file,
3124
3125              -cp "/lib/cool\
3126              \app/jars???
3127
3128       This is interpreted as:
3129
3130       -cp /lib/cool app/jars
3131
3132   Examples of Using Single Argument File
3133       You  can use a single argument file, such as myargumentfile in the fol‐
3134       lowing example, to hold all required java arguments:
3135
3136              java @myargumentfile
3137
3138   Examples of Using Argument Files with Paths
3139       You can include relative paths in argument files; however, they're rel‐
3140       ative  to the current working directory and not to the paths of the ar‐
3141       gument files themselves.  In the following example,  path1/options  and
3142       path2/options represent argument files with different paths.  Any rela‐
3143       tive paths that they contain are relative to the current working direc‐
3144       tory and not to the argument files:
3145
3146              java @path1/options @path2/classes
3147

CODE HEAP STATE ANALYTICS

3149   Overview
3150       There  are  occasions when having insight into the current state of the
3151       JVM code heap would be helpful to answer questions such as:
3152
3153       · Why was the JIT turned off and then on again and again?
3154
3155       · Where has all the code heap space gone?
3156
3157       · Why is the method sweeper not working effectively?
3158
3159       To provide this insight, a code heap state analytics feature  has  been
3160       implemented that enables on-the-fly analysis of the code heap.  The an‐
3161       alytics process is divided into two parts.  The first part examines the
3162       entire  code heap and aggregates all information that is believed to be
3163       useful or important.  The second part consists of  several  independent
3164       steps  that print the collected information with an emphasis on differ‐
3165       ent aspects of the data.  Data collection and printing are done  on  an
3166       "on request" basis.
3167
3168   Syntax
3169       Requests for real-time, on-the-fly analysis can be issued with the fol‐
3170       lowing command:
3171
3172              jcmd pid Compiler.CodeHeap_Analytics [function] [granularity]
3173
3174       If you are only interested in how the code heap looks like  after  run‐
3175       ning a sample workload, you can use the command line option:
3176
3177              -Xlog:codecache=Trace
3178
3179       To  see  the  code heap state when a "CodeCache full" condition exists,
3180       start the VM with the command line option:
3181
3182              -Xlog:codecache=Debug
3183
3184       See  CodeHeap  State  Analytics   (OpenJDK)   [https://bugs.openjdk.ja
3185       va.net/secure/attachment/75649/JVM_CodeHeap_StateAnalytics_V2.pdf]  for
3186       a detailed description of the code heap state  analytics  feature,  the
3187       supported functions, and the granularity options.
3188

ENABLE LOGGING WITH THE JVM UNIFIED LOGGING FRAMEWORK

3190       You  use  the -Xlog option to configure or enable logging with the Java
3191       Virtual Machine (JVM) unified logging framework.
3192
3193   Synopsis
3194              -Xlog[:[what][:[output][:[decorators][:output-options[,...]]]]]
3195
3196       what   Specifies  a  combination  of  tags  and  levels  of  the   form
3197              tag1[+tag2...][*][=level][,...].   Unless  the  wildcard  (*) is
3198              specified, only log messages tagged with exactly the tags speci‐
3199              fied are matched.  See -Xlog Tags and Levels.
3200
3201       output Sets  the  type of output.  Omitting the output type defaults to
3202              stdout.  See -Xlog Output.
3203
3204       decorators
3205              Configures the output to use a custom set of decorators.   Omit‐
3206              ting  decorators defaults to uptime, level, and tags.  See Deco‐
3207              rations.
3208
3209       output-options
3210              Sets the -Xlog logging output options.
3211
3212   Description
3213       The Java Virtual Machine (JVM) unified  logging  framework  provides  a
3214       common  logging  system  for all components of the JVM.  GC logging for
3215       the JVM has been changed to use the new logging framework.  The mapping
3216       of  old  GC  flags  to  the corresponding new Xlog configuration is de‐
3217       scribed in Convert GC Logging Flags to Xlog.  In addition, runtime log‐
3218       ging  has  also  been changed to use the JVM unified logging framework.
3219       The mapping of legacy runtime logging flags to  the  corresponding  new
3220       Xlog  configuration  is  described  in Convert Runtime Logging Flags to
3221       Xlog.
3222
3223       The following provides quick reference to the -Xlog command and  syntax
3224       for options:
3225
3226       -Xlog  Enables JVM logging on an info level.
3227
3228       -Xlog:help
3229              Prints  -Xlog usage syntax and available tags, levels, and deco‐
3230              rators along with example command lines with explanations.
3231
3232       -Xlog:disable
3233              Turns off all logging and clears all configuration of  the  log‐
3234              ging  framework including the default configuration for warnings
3235              and errors.
3236
3237       -Xlog[:option]
3238              Applies multiple arguments in the order that they appear on  the
3239              command  line.   Multiple  -Xlog  arguments  for the same output
3240              override each other in their given order.
3241
3242              The option is set as:
3243
3244                     [tag-selection][:[output][:[decorators][:output-op‐
3245                     tions]]]
3246
3247              Omitting  the  tag-selection  defaults to a tag-set of all and a
3248              level of info.
3249
3250                     tag[+...] all
3251
3252              The all tag is a meta tag consisting of all tag-sets  available.
3253              The  asterisk  *  in a tag set definition denotes a wildcard tag
3254              match.  Matching with a wildcard selects all tag sets that  con‐
3255              tain  at  least  the specified tags.  Without the wildcard, only
3256              exact matches of the specified tag sets are selected.
3257
3258              output-options is
3259
3260                     filecount=file-count filesize=file size with optional  K,
3261                     M or G suffix
3262
3263   Default Configuration
3264       When  the  -Xlog  option  and  nothing else is specified on the command
3265       line, the default configuration is  used.   The  default  configuration
3266       logs all messages with a level that matches either warning or error re‐
3267       gardless of what tags the message is associated with.  The default con‐
3268       figuration is equivalent to entering the following on the command line:
3269
3270              -Xlog:all=warning:stdout:uptime,level,tags
3271
3272   Controlling Logging at Runtime
3273       Logging  can also be controlled at run time through Diagnostic Commands
3274       (with the jcmd utility).  Everything that can be specified on the  com‐
3275       mand  line  can  also be specified dynamically with the VM.log command.
3276       As the diagnostic commands are automatically exposed as MBeans, you can
3277       use JMX to change logging configuration at run time.
3278
3279   -Xlog Tags and Levels
3280       Each  log  message  has  a level and a tag set associated with it.  The
3281       level of the message corresponds to its details, and the tag set corre‐
3282       sponds  to what the message contains or which JVM component it involves
3283       (such as, gc, jit, or os).  Mapping GC flags to the Xlog  configuration
3284       is  described in Convert GC Logging Flags to Xlog.  Mapping legacy run‐
3285       time logging flags to the corresponding Xlog configuration is described
3286       in Convert Runtime Logging Flags to Xlog.
3287
3288       Available log levels:
3289
3290       · off
3291
3292       · trace
3293
3294       · debug
3295
3296       · info
3297
3298       · warning
3299
3300       · error
3301
3302       Available log tags:
3303
3304       There  are  literally  dozens  of log tags, which in the right combina‐
3305       tions, will enable a range of logging output.  The full set  of  avail‐
3306       able  log tags can be seen using -Xlog:help.  Specifying all instead of
3307       a tag combination matches all tag combinations.
3308
3309   -Xlog Output
3310       The -Xlog option supports the following types of outputs:
3311
3312       · stdout --- Sends output to stdout
3313
3314       · stderr --- Sends output to stderr
3315
3316       · file=filename --- Sends output to text file(s).
3317
3318       When using file=filename, specifying %p and/or %t in the file name  ex‐
3319       pands  to  the  JVM's PID and startup timestamp, respectively.  You can
3320       also configure text files to handle file rotation based  on  file  size
3321       and  a  number of files to rotate.  For example, to rotate the log file
3322       every 10 MB and keep 5 files in rotation,  specify  the  options  file‐
3323       size=10M, filecount=5.   The  target size of the files isn't guaranteed
3324       to be exact, it's just an approximate value.  Files are rotated by  de‐
3325       fault  with  up to 5 rotated files of target size 20 MB, unless config‐
3326       ured  otherwise.   Specifying  filecount=0  means  that  the  log  file
3327       shouldn't  be  rotated.   There's a possibility of the pre-existing log
3328       file getting overwritten.
3329
3330   Decorations
3331       Logging messages are decorated with information about the message.  You
3332       can configure each output to use a custom set of decorators.  The order
3333       of the output is always the same as listed in the table.  You can  con‐
3334       figure  the  decorations  to  be  used  at  run  time.  Decorations are
3335       prepended to the log message.  For example:
3336
3337              [6.567s][info][gc,old] Old collection complete
3338
3339       Omitting decorators defaults to uptime, level, and tags.  The none dec‐
3340       orator is special and is used to turn off all decorations.
3341
3342       time  (t),  utctime  (utc),  uptime  (u), timemillis (tm), uptimemillis
3343       (um), timenanos (tn), uptimenanos (un), hostname  (hn),  pid  (p),  tid
3344       (ti), level (l), tags (tg) decorators can also be specified as none for
3345       no decoration.
3346
3347       Decorations       Description
3348       ──────────────────────────────────────────────────────────────────────────
3349       time or t         Current time and date in ISO-8601 format.
3350       utctime or utc    Universal Time  Coordinated  or  Coordinated  Universal
3351                         Time.
3352       uptime or u       Time  since  the  start  of the JVM in seconds and mil‐
3353                         liseconds.  For example, 6.567s.
3354       timemillis   or   The  same  value as generated by System.currentTimeMil‐
3355       tm                lis()
3356       uptimemillis or   Milliseconds since the JVM started.
3357       um
3358       timenanos or tn   The same value generated by System.nanoTime().
3359       uptimenanos  or   Nanoseconds since the JVM started.
3360       un
3361       hostname or hn    The host name.
3362       pid or p          The process identifier.
3363       tid or ti         The thread identifier.
3364       level or l        The level associated with the log message.
3365       tags or tg        The tag-set associated with the log message.
3366
3367   Convert GC Logging Flags to Xlog
3368       Legacy Garbage Collec‐   Xlog  Configura‐             Comment
3369       tion (GC) Flag           tion
3370       ───────────────────────────────────────────────────────────────────────────────────────
3371       G1PrintHeapRegions       -Xlog:gc+re‐                 Not Applicable
3372                                gion=trace
3373       GCLogFileSize            No configuration             Log rotation is handled by  the
3374                                available                    framework.
3375       NumberOfGCLogFiles       Not Applicable               Log  rotation is handled by the
3376                                                             framework.
3377       PrintAdaptiveSizePoli‐   -Xlog:gc+er‐                 Use a level of debug  for  most
3378       cy                       go*=level                    of  the information, or a level
3379                                                             of trace for all  of  what  was
3380                                                             logged    for    PrintAdaptive‐
3381                                                             SizePolicy.
3382       PrintGC                  -Xlog:gc                     Not Applicable
3383       PrintGCApplicationCon‐   -Xlog:safepoint              Note  that  PrintGCApplication‐
3384       currentTime                                           ConcurrentTime  and  PrintGCAp‐
3385                                                             plicationStoppedTime are logged
3386                                                             on the same tag and aren't sep‐
3387                                                             arated in the new logging.
3388
3389
3390
3391       PrintGCApplication‐      -Xlog:safepoint              Note  that  PrintGCApplication‐
3392       StoppedTime                                           ConcurrentTime  and  PrintGCAp‐
3393                                                             plicationStoppedTime are logged
3394                                                             on  the  same tag and not sepa‐
3395                                                             rated in the new logging.
3396       PrintGCCause             Not Applicable               GC cause is now always logged.
3397       PrintGCDateStamps        Not Applicable               Date stamps are logged  by  the
3398                                                             framework.
3399       PrintGCDetails           -Xlog:gc*                    Not Applicable
3400       PrintGCID                Not Applicable               GC ID is now always logged.
3401       PrintGCTaskTimeStamps    -Xlog:gc+task*=de‐           Not Applicable
3402                                bug
3403       PrintGCTimeStamps        Not Applicable               Time stamps are logged  by  the
3404                                                             framework.
3405       PrintHeapAtGC            -Xlog:gc+heap=trace          Not Applicable
3406       PrintReferenceGC         -Xlog:gc+ref*=debug          Note that in the  old  logging,
3407                                                             PrintReferenceGC  had an effect
3408                                                             only if PrintGCDetails was also
3409                                                             enabled.
3410       PrintStringDeduplica‐    `-Xlog:gc+stringdedup*=de‐   ` Not Applicable
3411       tionStatistics           bug
3412       PrintTenuringDistribu‐   -Xlog:gc+age*=level          Use a level of  debug  for  the
3413       tion                                                  most relevant information, or a
3414                                                             level of trace for all of  what
3415                                                             was   logged   for  PrintTenur‐
3416                                                             ingDistribution.
3417       UseGCLogFileRotation     Not Applicable               What was logged for PrintTenur‐
3418                                                             ingDistribution.
3419
3420   Convert Runtime Logging Flags to Xlog
3421       Legacy  Runtime   Xlog Configuration      Comment
3422       Flag
3423       ──────────────────────────────────────────────────────────────────────────────
3424       TraceExceptions   -Xlog:exceptions=in‐    Not Applicable
3425                         fo
3426       TraceClassLoad‐   -Xlog:class+load=lev‐   Use level=info for regular informa‐
3427       ing               el                      tion, or level=debug for additional
3428                                                 information.   In  Unified  Logging
3429                                                 syntax,    -verbose:class    equals
3430                                                 -Xlog:class+load=info,class+un‐
3431                                                 load=info.
3432       TraceClassLoad‐   -Xlog:class+pre‐        Not Applicable
3433       ingPreorder       order=debug
3434       TraceClassUn‐     -Xlog:class+un‐         Use level=info for regular informa‐
3435       loading           load=level              tion, or level=trace for additional
3436                                                 information.   In  Unified  Logging
3437                                                 syntax,    -verbose:class    equals
3438                                                 -Xlog:class+load=info,class+un‐
3439                                                 load=info.
3440       VerboseVerifi‐    -Xlog:verifica‐         Not Applicable
3441       cation            tion=info
3442       TraceClassPaths   -Xlog:class+path=info   Not Applicable
3443       TraceClassReso‐   -Xlog:class+re‐         Not Applicable
3444       lution            solve=debug
3445       TraceClassIni‐    -Xlog:class+init=info   Not Applicable
3446       tialization
3447       TraceLoaderCon‐   -Xlog:class+load‐       Not Applicable
3448       straints          er+constraints=info
3449       TraceClassLoad‐   -Xlog:class+load‐       Use level=debug for regular  infor‐
3450       erData            er+data=level           mation or level=trace for addition‐
3451                                                 al information.
3452       TraceSafepoint‐   -Xlog:safe‐             Not Applicable
3453       CleanupTime       point+cleanup=info
3454       TraceSafepoint    -Xlog:safepoint=debug   Not Applicable
3455       TraceMonitorIn‐   -Xlog:monitorinfla‐     Not Applicable
3456       flation           tion=debug
3457       TraceBiased‐      -Xlog:biasedlock‐       Use level=info for regular informa‐
3458       Locking           ing=level               tion, or level=trace for additional
3459                                                 information.
3460       TraceRede‐        -Xlog:rede‐             level=info, debug, and  trace  pro‐
3461       fineClasses       fine+class*=level       vide increasing amounts of informa‐
3462                                                 tion.
3463
3464   -Xlog Usage Examples
3465       The following are -Xlog examples.
3466
3467       -Xlog  Logs all messages by using the info level to stdout with uptime,
3468              levels, and tags decorations.  This is equivalent to using:
3469
3470                     -Xlog:all=info:stdout:uptime,levels,tags
3471
3472       -Xlog:gc
3473              Logs messages tagged with the gc tag using info level to stdout.
3474              The default configuration for all other messages at level  warn‐
3475              ing is in effect.
3476
3477       -Xlog:gc,safepoint
3478              Logs  messages tagged either with the gc or safepoint tags, both
3479              using the info level, to stdout, with default decorations.  Mes‐
3480              sages tagged with both gc and safepoint won't be logged.
3481
3482       -Xlog:gc+ref=debug
3483              Logs  messages tagged with both gc and ref tags, using the debug
3484              level to stdout, with default decorations.  Messages tagged only
3485              with one of the two tags won't be logged.
3486
3487       -Xlog:gc=debug:file=gc.txt:none
3488              Logs  messages tagged with the gc tag using the debug level to a
3489              file called gc.txt with no decorations.  The default  configura‐
3490              tion for all other messages at level warning is still in effect.
3491
3492       -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,file‐
3493       size=1024
3494              Logs messages tagged with the gc tag using the trace level to  a
3495              rotating file set with 5 files with size 1 MB with the base name
3496              gctrace.txt and uses decorations uptimemillis and pid.
3497
3498              The default configuration for all other messages at level  warn‐
3499              ing is still in effect.
3500
3501       -Xlog:gc::uptime,tid
3502              Logs  messages  tagged  with the gc tag using the default 'info'
3503              level to default the output stdout and uses  decorations  uptime
3504              and  tid.   The  default configuration for all other messages at
3505              level warning is still in effect.
3506
3507       -Xlog:gc*=info,safepoint*=off
3508              Logs messages tagged with at least gc using the info level,  but
3509              turns  off  logging of messages tagged with safepoint.  Messages
3510              tagged with both gc and safepoint won't be logged.
3511
3512       -Xlog:disable -Xlog:safepoint=trace:safepointtrace.txt
3513              Turns off all logging, including warnings and errors,  and  then
3514              enables  messages  tagged  with safepointusing tracelevel to the
3515              file safepointtrace.txt.  The default configuration doesn't  ap‐
3516              ply, because the command line started with -Xlog:disable.
3517
3518   Complex -Xlog Usage Examples
3519       The  following  describes a few complex examples of using the -Xlog op‐
3520       tion.
3521
3522       -Xlog:gc+class*=debug
3523              Logs messages tagged with at least gc and class tags  using  the
3524              debug  level to stdout.  The default configuration for all other
3525              messages at the level warning is still in effect
3526
3527       -Xlog:gc+meta*=trace,class*=off:file=gcmetatrace.txt
3528              Logs messages tagged with at least the gc and  meta  tags  using
3529              the trace level to the file metatrace.txt but turns off all mes‐
3530              sages tagged with class.  Messages tagged  with  gc,  meta,  and
3531              class  aren't  be  logged  as class* is set to off.  The default
3532              configuration for all other messages at level warning is in  ef‐
3533              fect except for those that include class.
3534
3535       -Xlog:gc+meta=trace
3536              Logs messages tagged with exactly the gc and meta tags using the
3537              trace level to stdout.  The default configuration for all  other
3538              messages at level warning is still be in effect.
3539
3540       -Xlog:gc+class+heap*=debug,meta*=warning,threads*=off
3541              Logs  messages tagged with at least gc, class, and heap tags us‐
3542              ing the trace level to stdout but only log messages tagged  with
3543              meta  with  level.  The default configuration for all other mes‐
3544              sages at the level warning is in effect except  for  those  that
3545              include threads.
3546

VALIDATE JAVA VIRTUAL MACHINE FLAG ARGUMENTS

3548       You  use values provided to all Java Virtual Machine (JVM) command-line
3549       flags  for  validation  and,  if  the  input  value   is   invalid   or
3550       out-of-range, then an appropriate error message is displayed.
3551
3552       Whether they're set ergonomically, in a command line, by an input tool,
3553       or through the APIs (for example, classes contained in the package  ja‐
3554       va.lang.management)  the  values  provided  to all Java Virtual Machine
3555       (JVM) command-line flags are validated.  Ergonomics  are  described  in
3556       Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collec‐
3557       tion Tuning Guide.
3558
3559       Range and constraints are validated either when all  flags  have  their
3560       values  set during JVM initialization or a flag's value is changed dur‐
3561       ing runtime (for example using the jcmd tool).  The JVM  is  terminated
3562       if  a value violates either the range or constraint check and an appro‐
3563       priate error message is printed on the error stream.
3564
3565       For example, if a flag violates a range or a constraint check, then the
3566       JVM exits with an error:
3567
3568              java -XX:AllocatePrefetchStyle=5 -version
3569              intx AllocatePrefetchStyle=5 is outside the allowed range [ 0 ... 3 ]
3570              Improperly specified VM option 'AllocatePrefetchStyle=5'
3571              Error: Could not create the Java Virtual Machine.
3572              Error: A fatal exception has occurred. Program will exit.
3573
3574       The flag -XX:+PrintFlagsRanges prints the range of all the flags.  This
3575       flag allows automatic testing of the flags by the  values  provided  by
3576       the  ranges.   For  the flags that have the ranges specified, the type,
3577       name, and the actual range is printed in the output.
3578
3579       For example,
3580
3581              intx   ThreadStackSize [ 0 ... 9007199254740987 ] {pd product}
3582
3583       For the flags that don't have the range specified,  the  values  aren't
3584       displayed in the print out.  For example:
3585
3586              size_t NewSize         [   ...                  ] {product}
3587
3588       This  helps to identify the flags that need to be implemented.  The au‐
3589       tomatic testing framework can skip those flags that don't  have  values
3590       and aren't implemented.
3591

LARGE PAGES

3593       You use large pages, also known as huge pages, as memory pages that are
3594       significantly larger than the standard memory page size  (which  varies
3595       depending on the processor and operating system).  Large pages optimize
3596       processor Translation-Lookaside Buffers.
3597
3598       A Translation-Lookaside Buffer (TLB) is a page translation  cache  that
3599       holds  the most-recently used virtual-to-physical address translations.
3600       A TLB is a scarce system resource.  A TLB miss can  be  costly  because
3601       the  processor  must  then read from the hierarchical page table, which
3602       may require multiple memory accesses.  By using a  larger  memory  page
3603       size, a single TLB entry can represent a larger memory range.  This re‐
3604       sults in less pressure on a TLB, and memory-intensive applications  may
3605       have better performance.
3606
3607       However,  large  pages page memory can negatively affect system perfor‐
3608       mance.  For example, when a large mount of memory is pinned by  an  ap‐
3609       plication,  it may create a shortage of regular memory and cause exces‐
3610       sive paging in other applications and slow down the entire system.  Al‐
3611       so,  a  system that has been up for a long time could produce excessive
3612       fragmentation, which could make it impossible to reserve  enough  large
3613       page  memory.  When this happens, either the OS or JVM reverts to using
3614       regular pages.
3615
3616       Oracle Solaris, Linux, and Windows support large pages.
3617
3618   Large Pages Support for Oracle Solaris
3619       Oracle Solaris includes Multiple Page Size Support  (MPSS).   No  addi‐
3620       tional configuration is necessary.
3621
3622   Large Pages Support for Linux
3623       The  2.6 kernel supports large pages.  Some vendors have backported the
3624       code to their 2.4-based releases.  To check if your system can  support
3625       large page memory, try the following:
3626
3627              # cat /proc/meminfo | grep Huge
3628              HugePages_Total: 0
3629              HugePages_Free: 0
3630              Hugepagesize: 2048 kB
3631
3632       If  the  output  shows the three "Huge" variables, then your system can
3633       support large page memory but it needs to be configured.  If  the  com‐
3634       mand  prints nothing, then your system doesn't support large pages.  To
3635       configure the system to use large page memory, login as root, and  then
3636       follow these steps:
3637
3638       1. If  you're  using  the  option  -XX:+UseSHM  (instead  of  -XX:+Use‐
3639          HugeTLBFS), then increase the SHMMAX value.  It must be larger  than
3640          the  Java  heap  size.   On  a  system with 4 GB of physical RAM (or
3641          less), the following makes all the memory sharable:
3642
3643                  # echo 4294967295 > /proc/sys/kernel/shmmax
3644
3645       2. If you're using the option -XX:+UseSHM  or  -XX:+UseHugeTLBFS,  then
3646          specify  the  number of large pages.  In the following example, 3 GB
3647          of a 4 GB system are reserved for large pages (assuming a large page
3648          size of 2048kB, then 3 GB = 3 * 1024 MB = 3072 MB = 3072 * 1024 kB =
3649          3145728 kB and 3145728 kB / 2048 kB = 1536):
3650
3651                  # echo 1536 > /proc/sys/vm/nr_hugepages
3652
3653                  Note: The values contained in /proc resets after you  reboot
3654                  your  system,  so  may want to set them in an initialization
3655                  script (for example, rc.local or sysctl.conf).
3656
3657       · If you configure (or resize) the OS kernel parameters  /proc/sys/ker‐
3658         nel/shmmax  or /proc/sys/vm/nr_hugepages, Java processes may allocate
3659         large pages for areas in addition to the Java heap.  These steps  can
3660         allocate large pages for the following areas:
3661
3662         · Java heap
3663
3664         · Code cache
3665
3666         · The marking bitmap data structure for the parallel GC
3667
3668         Consequently, if you configure the nr_hugepages parameter to the size
3669         of the Java heap, then the JVM can fail in allocating the code  cache
3670         areas on large pages because these areas are quite large in size.
3671
3672   Large Pages Support for Windows
3673       To use large pages support on Windows, the administrator must first as‐
3674       sign additional privileges to the user who is running the application:
3675
3676       1. Select Control Panel, Administrative Tools, and then Local  Security
3677          Policy.
3678
3679       2. Select Local Policies and then User Rights Assignment.
3680
3681       3. Double-click Lock pages in memory, then add users and/or groups.
3682
3683       4. Reboot your system.
3684
3685       Note that these steps are required even if it's the administrator who's
3686       running the application, because administrators by default  don't  have
3687       the privilege to lock pages in memory.
3688

APPLICATION CLASS DATA SHARING

3690       Application  Class  Data  Sharing  (AppCDS)  extends class data sharing
3691       (CDS) to enable application classes to be placed in a shared archive.
3692
3693       In addition to the core library classes,  AppCDS  supports  Class  Data
3694       Sharing  [https://docs.oracle.com/en/java/javase/12/vm/class-data-shar
3695       ing.html#GUID-7EAA3411-8CF0-4D19-BD05-DF5E1780AA91] from the  following
3696       locations:
3697
3698       · Platform classes from the runtime image
3699
3700       · Application classes from the runtime image
3701
3702       · Application classes from the class path
3703
3704       · Application classes from the module path
3705
3706       Archiving application classes provides better start up time at runtime.
3707       When running multiple JVM processes, AppCDS also  reduces  the  runtime
3708       footprint with memory sharing for read-only metadata.
3709
3710       CDS/AppCDS supports archiving classes from JAR files only.
3711
3712       Prior to JDK 11, a non-empty directory was reported as a fatal error in
3713       the following conditions:
3714
3715       · For base CDS, a non-empty directory cannot exist in the  -Xbootclass‐
3716         path/a path
3717
3718       · With  -XX:+UseAppCDS,  a  non-empty  directory could not exist in the
3719         -Xbootclasspath/a path, class path, and module path.
3720
3721       In JDK 11 and later, -XX:+UseAppCDS is obsolete and the behavior for  a
3722       non-empty  directory  is  based on the class types in the classlist.  A
3723       non-empty directory is reported as a fatal error in the following  con‐
3724       ditions:
3725
3726       · If  application classes or platform classes are not loaded, dump time
3727         only reports an error if a non-empty directory exists in -Xbootclass‐
3728         path/a path
3729
3730       · If  application classes or platform classes are loaded, dump time re‐
3731         ports an error for a non-empty directory that exists in  -Xbootclass‐
3732         path/a path, class path, or module path
3733
3734       In  JDK 11 and later, using -XX:DumpLoadedClassList=class_list_file re‐
3735       sults a generated classlist  with  all  classes  (both  system  library
3736       classes and application classes) included.  You no longer have to spec‐
3737       ify -XX:+UseAppCDS with -XX:DumpLoadedClassList to produce  a  complete
3738       class list.
3739
3740       In  JDK  11 and later, because UseAppCDS is obsolete, SharedArchiveFile
3741       becomes a product flag by default.   Specifying  +UnlockDiagnosticVMOp‐
3742       tions for SharedArchiveFile is no longer needed in any configuration.
3743
3744       Class Data Sharing (CDS)/AppCDS does not support archiving array class‐
3745       es in a class list.  When an array in the class  list  is  encountered,
3746       CDS dump time gives the explicit error message:
3747
3748              Preload Warning: Cannot find array_name
3749
3750       Although  an array in the class list is not allowed, some array classes
3751       can still be created at CDS/AppCDS dump time.  Those arrays are created
3752       during  the  execution  of the Java code used by the Java class loaders
3753       (PlatformClassLoader and the system class loader) to  load  classes  at
3754       dump time.  The created arrays are archived with the rest of the loaded
3755       classes.
3756
3757   Extending Class Data Sharing to Support the Module Path
3758       In JDK 11, Class Data Sharing (CDS) has been improved  to  support  ar‐
3759       chiving classes from the module path.
3760
3761       · To  create  a  CDS archive using the --module-path VM option, use the
3762         following command line syntax:
3763
3764                java -Xshare:dump -XX:SharedClassListFile=class_list_file
3765                -XX:SharedArchiveFile=shared_archive_file               --mod‐
3766                ule-path=path_to_modular_jar -m module_name
3767
3768       · To run with a CDS archive using the --module-path VM option, use  the
3769         following the command line syntax:
3770
3771                java -XX:SharedArchiveFile=shared_archive_file          --mod‐
3772                ule-path=path_to_modular_jar -m module_name
3773
3774       The following table describes how the  VM  options  related  to  module
3775       paths can be used along with the -Xshare option.
3776
3777       Option                -Xshare:dump          -Xshare:{on,auto}
3778       ────────────────────────────────────────────────────────────────
3779       --module-path[1] mp   Allowed               Allowed[2]
3780       --module              Allowed               Allowed
3781       --add-module          Allowed               Allowed
3782       --upgrade-mod‐        Disallowed   (exits   Allowed   (disables
3783       ule-path[3]           if specified)         CDS)
3784       --patch-module[4]     Disallowed   (exits   Allowed   (disables
3785                             if specified)         CDS)
3786       --limit-modules[5]    Disallowed   (exits   Allowed   (disables
3787                             if specified)         CDS)
3788
3789       [1] Although there are two ways of specifying  a  module  in  a  --mod‐
3790       ule-path,  that  is,  modular JAR or exploded module, only modular JARs
3791       are supported.
3792
3793       [2] Different mp can be specified during dump time versus run time.  If
3794       an  archived  class K was loaded from mp1.jar at dump time, but changes
3795       in mp cause it to be available from a different mp2.jar  at  run  time,
3796       then  the archived version of K will be disregarded at run time; K will
3797       be loaded dynamically.
3798
3799       [3] Currently, only two system modules are  upgradeable  (java.compiler
3800       and  jdk.internal.vm.compiler).   However, these modules are seldom up‐
3801       graded in production software.
3802
3803       [4] As documented in JEP 261, using --patch-module is strongly discour‐
3804       aged for production use.
3805
3806       [5]  --limit-modules  is  intended  for testing purposes.  It is seldom
3807       used in production software.
3808
3809       If --upgrade-module-path, --patch-module, or --limit-modules is  speci‐
3810       fied at dump time, an error will be printed and the JVM will exit.  For
3811       example, if the --limit-modules option is specified at dump  time,  the
3812       user will see the following error:
3813
3814              Error occurred during initialization of VM
3815              Cannot use the following option when dumping the shared archive: --limit-modules
3816
3817       If  --upgrade-module-path, --patch-module, or --limit-modules is speci‐
3818       fied at run time, a warning message will be printed indicating that CDS
3819       is  disabled.  For example, if the --limit-modules options is specified
3820       at run time, the user will see the following warning:
3821
3822              Java HotSpot(TM) 64-Bit Server VM warning: CDS is disabled when the --limit-modules option is specified.
3823
3824       Several other noteworthy things include:
3825
3826       · Any valid combinations of -cp and --module-path are supported.
3827
3828       · A non-empty directory in the module path causes a fatal  error.   The
3829         user will see the following error messages:
3830
3831                Error: non-empty directory <directory> Hint: enable -Xlog:class+path=info to diagnose the failure Error occurred during initialization of VM Cannot have non-empty directory in paths
3832
3833       · Unlike the class path, there's no restriction that the module path at
3834         dump time must be equal to or be a prefix of the module path  at  run
3835         time.
3836
3837       · The  archive  is invalidated if an existing JAR in the module path is
3838         updated after archive generation.
3839
3840       · Removing a JAR from the module path does not  invalidate  the  shared
3841         archive.   Archived classes from the removed JAR are not used at run‐
3842         time.
3843
3844   Dynamic CDS archive
3845       Dynamic CDS archive extends AppCDS to allow archiving of classes when a
3846       Java  application exits.  It improves the usability of AppCDS by elimi‐
3847       nating the trial run step for creating a class list for  each  applica‐
3848       tion.   The archived classes include all loaded application classes and
3849       library classes that are not present in the default CDS  archive  which
3850       is included in the JDK.
3851
3852       A  base  archive  is  required when creating a dynamic archive.  If the
3853       base archive is not specified, the default CDS archive is used  as  the
3854       base archive.
3855
3856       To  create  a  dynamic  CDS archive with the default CDS archive as the
3857       base archive, just add  the  -XX:ArchiveClassesAtExit=<dynamic archive>
3858       option to the command line for running the Java application.
3859
3860       If  the  default  CDS archive does not exist, the VM will exit with the
3861       following error:
3862
3863              ArchiveClassesAtExit not supported when base CDS archive is not loaded
3864
3865       To run the Java application using a dynamic CDS archive, just  add  the
3866       -XX:SharedArchiveFile=<dynamic archive>  option to the command line for
3867       running the Java application.
3868
3869       The base archive is not required to be specified in the  command  line.
3870       The base archive information, including its name and full path, will be
3871       retrieved from the dynamic archive header.  Note that  the  user  could
3872       also  use the -XX:SharedArchiveFile option for specifying a regular Ap‐
3873       pCDS   archive.    Therefore,   the   specified    archive    in    the
3874       -XX:SharedArchiveFile  option  could be either a regular or dynamic ar‐
3875       chive.  During VM start up the specified archive header will  be  read.
3876       If -XX:SharedArchiveFile refers to a regular archive, then the behavior
3877       will be unchanged.  If -XX:SharedArchiveFile refers to  a  dynamic  ar‐
3878       chive,  the VM will retrieve the base archive location from the dynamic
3879       archive.  If the dynamic archive was created with the default  CDS  ar‐
3880       chive,  then  the current default CDS archive will be used, and will be
3881       found relative to the current run time environment.
3882
3883       Please     refer     to      JDK-8221706      [https://bugs.openjdk.ja
3884       va.net/browse/JDK-8221706] for details on error checking during dynamic
3885       CDS archive dump time and run time.
3886
3887   Creating a Shared Archive File and Using It to Run an Application
3888   AppCDS archive
3889       The following steps create a shared archive file that contains all  the
3890       classes used by the test.Hello application.  The last step runs the ap‐
3891       plication with the shared archive file.
3892
3893       1. Create a list of all classes used  by  the  test.Hello  application.
3894          The following command creates a file named hello.classlist that con‐
3895          tains a list of all classes used by this application:
3896
3897                  java -Xshare:off -XX:DumpLoadedClassList=hel‐
3898                  lo.classlist -cp hello.jar test.Hello
3899
3900           Note that the classpath specified by the -cp parameter must contain
3901           only JAR files.
3902
3903       2. Create a shared archive, named  hello.jsa,  that  contains  all  the
3904          classes in hello.classlist:
3905
3906                  java -Xshare:dump -XX:SharedArchiveFile=hel‐
3907                  lo.jsa -XX:SharedClassListFile=hello.classlist -cp hello.jar
3908
3909           Note that the classpath used at archive creation time must  be  the
3910           same as (or a prefix of) the classpath used at run time.
3911
3912       3. Run the application test.Hello with the shared archive hello.jsa:
3913
3914                  java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hel‐
3915                  lo
3916
3917       4. Optional Verify that the test.Hello application is using  the  class
3918          contained in the hello.jsa shared archive:
3919
3920                  java -XX:SharedArchiveFile=hello.jsa -cp hello.jar -ver‐
3921                  bose:class test.Hello
3922
3923           The output of this command should contain the following text:
3924
3925                  Loaded test.Hello from shared objects file by sun/misc/Launcher$AppClassLoader
3926
3927   Dynamic CDS archive
3928       The following steps create a dynamic CDS archive file that contains the
3929       classes  used by the test.Hello application and are not included in the
3930       default CDS archive.  The second step runs the application with the dy‐
3931       namic CDS archive.
3932
3933       1. Create a dynamic CDS archive, named hello.jsa, that contains all the
3934          classes in hello.jar loaded by the application test.Hello:
3935
3936                  java -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello
3937
3938           Note that the classpath used at archive creation time must  be  the
3939           same as (or a prefix of) the classpath used at run time.
3940
3941       2. Run the application test.Hello with the shared archive hello.jsa:
3942
3943                  java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hel‐
3944                  lo
3945
3946       3. Optional Repeat step 4 of the previous section to  verify  that  the
3947          test.Hello application is using the class contained in the hello.jsa
3948          shared archive.
3949
3950       To automate the above steps 1 and 2, one can write a script such as the
3951       following:
3952
3953                  ARCHIVE=hello.jsa
3954                  if test -f $ARCHIVE; then
3955                      FLAG="-XX:SharedArchiveFile=$ARCHIVE"
3956                  else
3957                      FLAG="-XX:ArchiveClassesAtExit=$ARCHIVE"
3958                  fi
3959                  $JAVA_HOME/bin/java -cp hello.jar $FLAG test.Hello
3960
3961       Like an AppCDS archive, the archive needs to be re-generated if the Ja‐
3962       va version has changed.  The above script could be adjusted to  account
3963       for the Java version as follows:
3964
3965                  ARCHIVE=hello.jsa
3966                  VERSION=foo.version
3967                  if test -f $ARCHIVE -a -f $VERSION && cmp -s $VERSION $JAVA_HOME/release; then
3968                      FLAG="-XX:SharedArchiveFile=$ARCHIVE"
3969                  else
3970                      FLAG="-XX:ArchiveClassesAtExit=$ARCHIVE"
3971                      cp -f $JAVA_HOME/release $VERSION
3972                  fi
3973                  $JAVA_HOME/bin/java -cp hello.jar $FLAG test.Hello
3974
3975       Currently,  we  don't support concurrent dumping operations to the same
3976       CDS archive.  Care should be taken to avoid  multiple  writers  to  the
3977       same CDS archive.
3978
3979       The  user  could also create a dynamic CDS archive with a specific base
3980       archive, e.g.  named as base.jsa as follows:
3981
3982              java -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtEx‐
3983              it=hello.jsa -cp hello.jar Hello
3984
3985       To  run  the  application using the dynamic CDS archive hello.jsa and a
3986       specific base CDS archive base.jsa:
3987
3988              java -XX:SharedArchiveFile=base.jsa:hello.jsa -cp hello.jar Hel‐
3989              lo
3990
3991       Note  that  on  Windows,  the above path delimiter : should be replaced
3992       with ;.
3993
3994       The above command for specifying a base archive is useful if  the  base
3995       archive  used for creating the dynamic archive has been moved.  Normal‐
3996       ly, just specifying the dynamic archive should be sufficient since  the
3997       base archive info can be retrieved from the dynamic archive header.
3998
3999   Sharing a Shared Archive Across Multiple Application Processes
4000       You  can  share the same archive file across multiple applications pro‐
4001       cesses.  This reduces memory usage because the archive is memory-mapped
4002       into the address space of the processes.  The operating system automat‐
4003       ically shares the read-only pages across these processes.
4004
4005       The following steps demonstrate how to create a common archive that can
4006       be  shared  by  different  applications.  Classes from common.jar, hel‐
4007       lo.jar and hi.jar are archived in the common.jsa because they  are  all
4008       in the classpath during the archiving step (step 3).
4009
4010       To  include  classes  from hello.jar and hi.jar, the .jar files must be
4011       added to the classpath specified by the -cp parameter.
4012
4013       1. Create a list of all classes used by the Hello application  and  an‐
4014          other list for the Hi application:
4015
4016                  java -XX:DumpLoadedClassList=hello.classlist -cp com‐
4017                  mon.jar:hello.jar Hello
4018
4019                  java -XX:DumpLoadedClassList=hi.classlist -cp com‐
4020                  mon.jar:hi.jar Hi
4021
4022       2. Create  a  single  list of classes used by all the applications that
4023          will share the shared archive file.
4024
4025           Oracle Solaris, Linux, and macOS The following commands combine the
4026           files   hello.classlist   and  hi.classlist  into  one  file,  com‐
4027           mon.classlist:
4028
4029                  cat hello.classlist hi.classlist > common.classlist
4030
4031           Windows The following commands combine  the  files  hello.classlist
4032           and hi.classlist into one file, common.classlist:
4033
4034                  type hello.classlist hi.classlist > common.classlist
4035
4036       3. Create  a  shared  archive  named  common.jsa  that contains all the
4037          classes in common.classlist:
4038
4039                  java -Xshare:dump -XX:SharedArchiveFile=com‐
4040                  mon.jsa -XX:SharedClassListFile=common.classlist -cp com‐
4041                  mon.jar:hello.jar:hi.jar
4042
4043           The classpath parameter used is the common class path prefix shared
4044           by the Hello and Hi applications.
4045
4046       4. Run the Hello and Hi applications with the same shared archive:
4047
4048                  java -XX:SharedArchiveFile=common.jsa -cp common.jar:hel‐
4049                  lo.jar:hi.jar Hello
4050
4051                  java -XX:SharedArchiveFile=common.jsa -cp common.jar:hel‐
4052                  lo.jar:hi.jar Hi
4053
4054   Specifying Additional Shared Data Added to an Archive File
4055       The SharedArchiveConfigFile option is used to specify additional shared
4056       data to add to the archive file.
4057
4058              -XX:SharedArchiveConfigFile=shared_config_file
4059
4060       JDK 9 and later supports adding both symbols and string objects  to  an
4061       archive for memory sharing when you have multiple JVM processes running
4062       on the same host.  An example of this is having multiple JVM  processes
4063       that  use  the  same set of Java EE classes.  When these common classes
4064       are loaded and used, new symbols and strings may be created  and  added
4065       to  the  JVM's  internal "symbol" and "string" tables.  At runtime, the
4066       symbols or string objects mapped from the archive file  can  be  shared
4067       across multiple JVM processes, resulting in a reduction of overall mem‐
4068       ory usage.  In addition, archiving strings also provides added  perfor‐
4069       mance benefits in both startup time and runtime execution.
4070
4071       In  JDK  10  and later, CONSTANT_String entries in archived classes are
4072       resolved to interned String objects at  dump  time,  and  all  interned
4073       String  objects are archived.  However, even though all CONSTANT_String
4074       literals in all archived classes are resolved, it might  still  benefi‐
4075       cial  to  add  additional strings that are not string literals in class
4076       files, but are likely to be used by your application at run time.
4077
4078       Symbol data should be generated by the jcmd tool attaching to a running
4079       JVM process.  See jcmd.
4080
4081       The following is an example of the symbol dumping command in jcmd:
4082
4083              jcmd pid VM.symboltable -verbose
4084
4085              Note:  The  first  line  (process ID) and the second line (@VER‐
4086              SION ...) of this jcmd output should be excluded from  the  con‐
4087              figuration file.
4088
4089   Example of a Configuration File
4090       The following is an example of a configuration file:
4091
4092              VERSION: 1.0
4093              @SECTION: Symbol
4094              10 -1: linkMethod
4095
4096       In  the configuration file example, the @SECTION: Symbol entry uses the
4097       following format:
4098
4099              length refcount: symbol
4100
4101       The refcount for a shared symbol is always -1.
4102
4103       @SECTION specifies the type of the section that follows it.   All  data
4104       within  the section must be the same type that's specified by @SECTION.
4105       Different types of data can't be mixed.  Multiple separated  data  sec‐
4106       tions  for  the  same  type specified by different @SECTION are allowed
4107       within one shared_config_file .
4108

PERFORMANCE TUNING EXAMPLES

4110       You can use the Java advanced runtime options to optimize  the  perfor‐
4111       mance of your applications.
4112
4113   Tuning for Higher Throughput
4114       Use  the  following  commands  and  advanced  options to achieve higher
4115       throughput performance for your application:
4116
4117              java -server -XX:+UseParallelGC -XX:+Use‐
4118              LargePages -Xmn10g  -Xms26g -Xmx26g
4119
4120   Tuning for Lower Response Time
4121       Use  the  following  commands and advanced options to achieve lower re‐
4122       sponse times for your application:
4123
4124              java -XX:+UseG1GC -XX:MaxGCPauseMillis=100
4125
4126   Keeping the Java Heap Small and Reducing the Dynamic Footprint of
4127       Embedded Applications
4128
4129       Use the following advanced runtime options to keep the Java heap  small
4130       and reduce the dynamic footprint of embedded applications:
4131
4132              -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5
4133
4134              Note: The defaults for these two options are 70% and 40% respec‐
4135              tively.  Because performance sacrifices  can  occur  when  using
4136              these  small settings, you should optimize for a small footprint
4137              by reducing these settings as much as possible without introduc‐
4138              ing unacceptable performance degradation.
4139

EXIT STATUS

4141       The  following  exit values are typically returned by the launcher when
4142       the launcher is called with the wrong arguments, serious errors, or ex‐
4143       ceptions  thrown by the JVM.  However, a Java application may choose to
4144       return any value by using the  API  call  System.exit(exitValue).   The
4145       values are:
4146
4147       · 0: Successful completion
4148
4149       · >0: An error occurred
4150
4151
4152
4153JDK 14                               2020                              JAVA(1)
Impressum