1 .\"t 2 .\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. 3 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 .\" 5 .\" This code is free software; you can redistribute it and/or modify it 6 .\" under the terms of the GNU General Public License version 2 only, as 7 .\" published by the Free Software Foundation. 8 .\" 9 .\" This code is distributed in the hope that it will be useful, but WITHOUT 10 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 .\" version 2 for more details (a copy is included in the LICENSE file that 13 .\" accompanied this code). 14 .\" 15 .\" You should have received a copy of the GNU General Public License version 16 .\" 2 along with this work; if not, write to the Free Software Foundation, 17 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 .\" 19 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 .\" or visit www.oracle.com if you need additional information or have any 21 .\" questions. 22 .\" 23 .\" Automatically generated by Pandoc 2.3.1 24 .\" 25 .TH "JAVA" "1" "2019" "JDK 13" "JDK Commands" 26 .hy 27 .SH NAME 28 .PP 29 java \- launch a Java application 30 .SH SYNOPSIS 31 .PP 32 To launch a class file: 33 .PP 34 \f[CB]java\f[R] [\f[I]options\f[R]] \f[I]mainclass\f[R] [\f[I]args\f[R] ...] 35 .PP 36 To launch the main class in a JAR file: 37 .PP 38 \f[CB]java\f[R] [\f[I]options\f[R]] \f[CB]\-jar\f[R] \f[I]jarfile\f[R] 39 [\f[I]args\f[R] ...] 40 .PP 41 To launch the main class in a module: 42 .PP 43 \f[CB]java\f[R] [\f[I]options\f[R]] \f[CB]\-m\f[R] 44 \f[I]module\f[R][\f[CB]/\f[R]\f[I]mainclass\f[R]] [\f[I]args\f[R] ...] 45 .PP 46 or 47 .PP 48 \f[CB]java\f[R] [\f[I]options\f[R]] \f[CB]\-\-module\f[R] 49 \f[I]module\f[R][\f[CB]/\f[R]\f[I]mainclass\f[R]] [\f[I]args\f[R] ...] 50 .PP 51 To launch a single source\-file program: 52 .PP 53 \f[CB]java\f[R] [\f[I]options\f[R]] \f[I]source\-file\f[R] [\f[I]args\f[R] 54 \&...] 55 .TP 56 .B \f[I]options\f[R] 57 Optional: Specifies command\-line options separated by spaces. 58 See \f[B]Overview of Java Options\f[R] for a description of available 59 options. 60 .RS 61 .RE 62 .TP 63 .B \f[I]mainclass\f[R] 64 Specifies the name of the class to be launched. 65 Command\-line entries following \f[CB]classname\f[R] are the arguments for 66 the main method. 67 .RS 68 .RE 69 .TP 70 .B \f[CB]\-jar\f[R] \f[I]jarfile\f[R] 71 Executes a program encapsulated in a JAR file. 72 The \f[I]jarfile\f[R] argument is the name of a JAR file with a manifest 73 that contains a line in the form \f[CB]Main\-Class:\f[R]\f[I]classname\f[R] 74 that defines the class with the 75 \f[CB]public\ static\ void\ main(String[]\ args)\f[R] method that serves 76 as your application\[aq]s starting point. 77 When you use \f[CB]\-jar\f[R], the specified JAR file is the source of all 78 user classes, and other class path settings are ignored. 79 If you\[aq]re using JAR files, then see \f[B]jar\f[R]. 80 .RS 81 .RE 82 .TP 83 .B \f[CB]\-m\f[R] or \f[CB]\-\-module\f[R] \f[I]module\f[R][\f[CB]/\f[R]\f[I]mainclass\f[R]] 84 Executes the main class in a module specified by \f[I]mainclass\f[R] if 85 it is given, or, if it is not given, the value in the \f[I]module\f[R]. 86 In other words, \f[I]mainclass\f[R] can be used when it is not specified 87 by the module, or to override the value when it is specified. 88 .RS 89 .PP 90 See \f[B]Standard Options for Java\f[R]. 91 .RE 92 .TP 93 .B \f[I]source\-file\f[R] 94 Only used to launch a single source\-file program. 95 Specifies the source file that contains the main class when using 96 source\-file mode. 97 See \f[B]Using Source\-File Mode to Launch Single\-File Source\-Code 98 Programs\f[R] 99 .RS 100 .RE 101 .TP 102 .B \f[I]args\f[R] ... 103 Optional: Arguments following \f[I]mainclass\f[R], \f[I]source\-file\f[R], 104 \f[CB]\-jar\f[R] \f[I]jarfile\f[R], and \f[CB]\-m\f[R] or \f[CB]\-\-module\f[R] 105 \f[I]module\f[R]\f[CB]/\f[R]\f[I]mainclass\f[R] are passed as arguments to 106 the main class. 107 .RS 108 .RE 109 .SH DESCRIPTION 110 .PP 111 The \f[CB]java\f[R] command starts a Java application. 112 It does this by starting the Java Virtual Machine (JVM), loading the 113 specified class, and calling that class\[aq]s \f[CB]main()\f[R] method. 114 The method must be declared \f[CB]public\f[R] and \f[CB]static\f[R], it must 115 not return any value, and it must accept a \f[CB]String\f[R] array as a 116 parameter. 117 The method declaration has the following form: 118 .RS 119 .PP 120 \f[CB]public\ static\ void\ main(String[]\ args)\f[R] 121 .RE 122 .PP 123 In source\-file mode, the \f[CB]java\f[R] command can launch a class 124 declared in a source file. 125 See \f[B]Using Source\-File Mode to Launch Single\-File Source\-Code 126 Programs\f[R] for a description of using the source\-file mode. 127 .RS 128 .PP 129 \f[B]Note:\f[R] You can use the \f[CB]JDK_JAVA_OPTIONS\f[R] launcher 130 environment variable to prepend its content to the actual command line 131 of the \f[CB]java\f[R] launcher. 132 See \f[B]Using the JDK_JAVA_OPTIONS Launcher Environment Variable\f[R]. 133 .RE 134 .PP 135 By default, the first argument that isn\[aq]t an option of the 136 \f[CB]java\f[R] command is the fully qualified name of the class to be 137 called. 138 If \f[CB]\-jar\f[R] is specified, then its argument is the name of the JAR 139 file containing class and resource files for the application. 140 The startup class must be indicated by the \f[CB]Main\-Class\f[R] manifest 141 header in its manifest file. 142 .PP 143 Arguments after the class file name or the JAR file name are passed to 144 the \f[CB]main()\f[R] method. 145 .SS \f[CB]javaw\f[R] 146 .PP 147 \f[B]Windows:\f[R] The \f[CB]javaw\f[R] command is identical to 148 \f[CB]java\f[R], except that with \f[CB]javaw\f[R] there\[aq]s no associated 149 console window. 150 Use \f[CB]javaw\f[R] when you don\[aq]t want a command prompt window to 151 appear. 152 The \f[CB]javaw\f[R] launcher will, however, display a dialog box with 153 error information if a launch fails. 154 .SH USING SOURCE\-FILE MODE TO LAUNCH SINGLE\-FILE SOURCE\-CODE PROGRAMS 155 .PP 156 To launch a class declared in a source file, run the \f[CB]java\f[R] 157 launcher in source\-file mode. 158 Entering source\-file mode is determined by two items on the 159 \f[CB]java\f[R] command line: 160 .IP \[bu] 2 161 The first item on the command line that is not an option or part of an 162 option. 163 In other words, the item in the command line that would otherwise be the 164 main class name. 165 .IP \[bu] 2 166 The \f[CB]\-\-source\f[R] \f[I]version\f[R] option, if present. 167 .PP 168 If the class identifies an existing file that has a \f[CB]\&.java\f[R] 169 extension, or if the \f[CB]\-\-source\f[R] option is specified, then 170 source\-file mode is selected. 171 The source file is then compiled and run. 172 The \f[CB]\-\-source\f[R] option can be used to specify the source 173 \f[I]version\f[R] or \f[I]N\f[R] of the source code. 174 This determines the API that can be used. 175 When you set \f[CB]\-\-source\f[R] \f[I]N\f[R], you can only use the public 176 API that was defined in JDK \f[I]N\f[R]. 177 .RS 178 .PP 179 \f[B]Note:\f[R] The valid values of \f[I]N\f[R] change for each release, 180 with new values added and old values removed. 181 You\[aq]ll get an error message if you use a value of \f[I]N\f[R] that is 182 no longer supported. 183 Supported values of \f[I]N\f[R] for this release are \f[CB]7\f[R], 184 \f[CB]8\f[R], \f[CB]9\f[R], \f[CB]10\f[R], \f[CB]11\f[R], \f[CB]12\f[R], and 185 \f[CB]13\f[R]. 186 .RE 187 .PP 188 If the file does not have the \f[CB]\&.java\f[R] extension, the 189 \f[CB]\-\-source\f[R] option must be used to tell the \f[CB]java\f[R] 190 command to use the source\-file mode. 191 The \f[CB]\-\-source\f[R] option is used for cases when the source file is 192 a "script" to be executed and the name of the source file does not 193 follow the normal naming conventions for Java source files. 194 .PP 195 In source\-file mode, the effect is as though the source file is 196 compiled into memory, and the first class found in the source file is 197 executed. 198 Any arguments placed after the name of the source file in the original 199 command line are passed to the compiled class when it is executed. 200 .PP 201 For example, if a file were named \f[CB]HelloWorld.java\f[R] and contained 202 a class named \f[CB]hello.World\f[R], then the source\-file mode command 203 to launch the class would be: 204 .RS 205 .PP 206 \f[CB]java\ HelloWorld.java\f[R] 207 .RE 208 .PP 209 The example illustrates that the class can be in a named package, and 210 does not need to be in the unnamed package. 211 This use of source\-file mode is informally equivalent to using the 212 following two commands where \f[CB]hello.World\f[R] is the name of the 213 class in the package: 214 .IP 215 .nf 216 \f[CB] 217 javac\ \-d\ <memory>\ HelloWorld.java 218 java\ \-cp\ <memory>\ hello.World 219 \f[R] 220 .fi 221 .PP 222 \f[B]In source\-file mode, any additional command\-line options are 223 processed as follows:\f[R] 224 .IP \[bu] 2 225 The launcher scans the options specified before the source file for any 226 that are relevant in order to compile the source file. 227 .RS 2 228 .PP 229 This includes: \f[CB]\-\-class\-path\f[R], \f[CB]\-\-module\-path\f[R], 230 \f[CB]\-\-add\-exports\f[R], \f[CB]\-\-add\-modules\f[R], 231 \f[CB]\-\-limit\-modules\f[R], \f[CB]\-\-patch\-module\f[R], 232 \f[CB]\-\-upgrade\-module\-path\f[R], and any variant forms of those 233 options. 234 It also includes the new \f[CB]\-\-enable\-preview\f[R] option, described 235 in JEP 12. 236 .RE 237 .IP \[bu] 2 238 No provision is made to pass any additional options to the compiler, 239 such as \f[CB]\-processor\f[R] or \f[CB]\-Werror\f[R]. 240 .IP \[bu] 2 241 Command\-line argument files (\f[CB]\@\f[R]\-files) may be used in the 242 standard way. 243 Long lists of arguments for either the VM or the program being invoked 244 may be placed in files specified on the command\-line by prefixing the 245 filename with an \f[CB]\@\f[R] character. 246 .PP 247 \f[B]In source\-file mode, compilation proceeds as follows:\f[R] 248 .IP \[bu] 2 249 Any command\-line options that are relevant to the compilation 250 environment are taken into account. 251 .IP \[bu] 2 252 No other source files are found and compiled, as if the source path is 253 set to an empty value. 254 .IP \[bu] 2 255 Annotation processing is disabled, as if \f[CB]\-proc:none\f[R] is in 256 effect. 257 .IP \[bu] 2 258 If a version is specified, via the \f[CB]\-\-source\f[R] option, the value 259 is used as the argument for an implicit \f[CB]\-\-release\f[R] option for 260 the compilation. 261 This sets both the source version accepted by compiler and the system 262 API that may be used by the code in the source file. 263 .IP \[bu] 2 264 The source file is compiled in the context of an unnamed module. 265 .IP \[bu] 2 266 The source file should contain one or more top\-level classes, the first 267 of which is taken as the class to be executed. 268 .IP \[bu] 2 269 The compiler does not enforce the optional restriction defined at the 270 end of JLS §7.6, that a type in a named package should exist in a file 271 whose name is composed from the type name followed by the 272 \f[CB]\&.java\f[R] extension. 273 .IP \[bu] 2 274 If the source file contains errors, appropriate error messages are 275 written to the standard error stream, and the launcher exits with a 276 non\-zero exit code. 277 .PP 278 \f[B]In source\-file mode, execution proceeds as follows:\f[R] 279 .IP \[bu] 2 280 The class to be executed is the first top\-level class found in the 281 source file. 282 It must contain a declaration of the standard 283 \f[CB]public\ static\ void\ main(String[])\f[R] method. 284 .IP \[bu] 2 285 The compiled classes are loaded by a custom class loader, that delegates 286 to the application class loader. 287 This implies that classes appearing on the application class path cannot 288 refer to any classes declared in the source file. 289 .IP \[bu] 2 290 The compiled classes are executed in the context of an unnamed module, 291 as though \f[CB]\-\-add\-modules=ALL\-DEFAULT\f[R] is in effect. 292 This is in addition to any other \f[CB]\-\-add\-module\f[R] options that 293 may be have been specified on the command line. 294 .IP \[bu] 2 295 Any arguments appearing after the name of the file on the command line 296 are passed to the standard main method in the obvious way. 297 .IP \[bu] 2 298 It is an error if there is a class on the application class path whose 299 name is the same as that of the class to be executed. 300 .PP 301 See \f[B]JEP 330: Launch Single\-File Source\-Code Programs\f[R] 302 [http://openjdk.java.net/jeps/330] for complete details. 303 .SH USING THE JDK_JAVA_OPTIONS LAUNCHER ENVIRONMENT VARIABLE 304 .PP 305 \f[CB]JDK_JAVA_OPTIONS\f[R] prepends its content to the options parsed 306 from the command line. 307 The content of the \f[CB]JDK_JAVA_OPTIONS\f[R] environment variable is a 308 list of arguments separated by white\-space characters (as determined by 309 \f[CB]isspace()\f[R]). 310 These are prepended to the command line arguments passed to 311 \f[CB]java\f[R] launcher. 312 The encoding requirement for the environment variable is the same as the 313 \f[CB]java\f[R] command line on the system. 314 \f[CB]JDK_JAVA_OPTIONS\f[R] environment variable content is treated in the 315 same manner as that specified in the command line. 316 .PP 317 Single (\f[CB]\[aq]\f[R]) or double (\f[CB]"\f[R]) quotes can be used to 318 enclose arguments that\ contain whitespace characters. 319 All content between the open quote and the first matching close quote 320 are preserved by simply removing the pair of quotes. 321 In case a matching quote is not found, the launcher will abort with an 322 error message. 323 \f[CB]\@\f[R]\-files are supported as they are specified in the command 324 line. 325 However, as in \f[CB]\@\f[R]\-files, use of a wildcard is not supported. 326 In order to mitigate potential misuse of \f[CB]JDK_JAVA_OPTIONS\f[R] 327 behavior, options that specify the main class (such as \f[CB]\-jar\f[R]) 328 or cause the \f[CB]java\f[R] launcher to exit without executing the main 329 class (such as \f[CB]\-h\f[R]) are disallowed in the environment variable. 330 If any of these options appear in the environment variable, the launcher 331 will abort with an error message. 332 When \f[CB]JDK_JAVA_OPTIONS\f[R] is set, the launcher prints a message to 333 stderr as a reminder. 334 .PP 335 \f[B]Example:\f[R] 336 .IP 337 .nf 338 \f[CB] 339 $\ export\ JDK_JAVA_OPTIONS=\[aq]\-g\ \@file1\ \-Dprop=value\ \@file2\ \-Dws.prop="white\ spaces"\[aq] 340 $\ java\ \-Xint\ \@file3 341 \f[R] 342 .fi 343 .PP 344 is equivalent to the command line: 345 .IP 346 .nf 347 \f[CB] 348 java\ \-g\ \@file1\ \-Dprop=value\ \@file2\ \-Dws.prop="white\ spaces"\ \-Xint\ \@file3 349 \f[R] 350 .fi 351 .SH OVERVIEW OF JAVA OPTIONS 352 .PP 353 The \f[CB]java\f[R] command supports a wide range of options in the 354 following categories: 355 .IP \[bu] 2 356 \f[B]Standard Options for Java\f[R]: Options guaranteed to be supported 357 by all implementations of the Java Virtual Machine (JVM). 358 They\[aq]re used for common actions, such as checking the version of the 359 JRE, setting the class path, enabling verbose output, and so on. 360 .IP \[bu] 2 361 \f[B]Extra Options for Java\f[R]: General purpose options that are 362 specific to the Java HotSpot Virtual Machine. 363 They aren\[aq]t guaranteed to be supported by all JVM implementations, 364 and are subject to change. 365 These options start with \f[CB]\-X\f[R]. 366 .PP 367 The advanced options aren\[aq]t recommended for casual use. 368 These are developer options used for tuning specific areas of the Java 369 HotSpot Virtual Machine operation that often have specific system 370 requirements and may require privileged access to system configuration 371 parameters. 372 Several examples of performance tuning are provided in \f[B]Performance 373 Tuning Examples\f[R]. 374 These options aren\[aq]t guaranteed to be supported by all JVM 375 implementations and are subject to change. 376 Advanced options start with \f[CB]\-XX\f[R]. 377 .IP \[bu] 2 378 \f[B]Advanced Runtime Options for Java\f[R]: Control the runtime behavior 379 of the Java HotSpot VM. 380 .IP \[bu] 2 381 \f[B]Advanced JIT Compiler Options for java\f[R]: Control the dynamic 382 just\-in\-time (JIT) compilation performed by the Java HotSpot VM. 383 .IP \[bu] 2 384 \f[B]Advanced Serviceability Options for Java\f[R]: Enable gathering 385 system information and performing extensive debugging. 386 .IP \[bu] 2 387 \f[B]Advanced Garbage Collection Options for Java\f[R]: Control how 388 garbage collection (GC) is performed by the Java HotSpot 389 .PP 390 Boolean options are used to either enable a feature that\[aq]s disabled 391 by default or disable a feature that\[aq]s enabled by default. 392 Such options don\[aq]t require a parameter. 393 Boolean \f[CB]\-XX\f[R] options are enabled using the plus sign 394 (\f[CB]\-XX:+\f[R]\f[I]OptionName\f[R]) and disabled using the minus sign 395 (\f[CB]\-XX:\-\f[R]\f[I]OptionName\f[R]). 396 .PP 397 For options that require an argument, the argument may be separated from 398 the option name by a space, a colon (:), or an equal sign (=), or the 399 argument may directly follow the option (the exact syntax differs for 400 each option). 401 If you\[aq]re expected to specify the size in bytes, then you can use no 402 suffix, or use the suffix \f[CB]k\f[R] or \f[CB]K\f[R] for kilobytes (KB), 403 \f[CB]m\f[R] or \f[CB]M\f[R] for megabytes (MB), or \f[CB]g\f[R] or \f[CB]G\f[R] 404 for gigabytes (GB). 405 For example, to set the size to 8 GB, you can specify either 406 \f[CB]8g\f[R], \f[CB]8192m\f[R], \f[CB]8388608k\f[R], or \f[CB]8589934592\f[R] 407 as the argument. 408 If you are expected to specify the percentage, then use a number from 0 409 to 1. 410 For example, specify \f[CB]0.25\f[R] for 25%. 411 .PP 412 The following sections describe the options that are obsolete, 413 deprecated, and removed: 414 .IP \[bu] 2 415 \f[B]Deprecated Java Options\f[R]: Accepted and acted upon \-\-\- a 416 warning is issued when they\[aq]re used. 417 .IP \[bu] 2 418 \f[B]Obsolete Java Options\f[R]: Accepted but ignored \-\-\- a warning is 419 issued when they\[aq]re used. 420 .IP \[bu] 2 421 \f[B]Removed Java Options\f[R]: Removed \-\-\- using them results in an 422 error. 423 .SH STANDARD OPTIONS FOR JAVA 424 .PP 425 These are the most commonly used options supported by all 426 implementations of the JVM. 427 .RS 428 .PP 429 \f[B]Note:\f[R] To specify an argument for a long option, you can use 430 either \f[CB]\-\-\f[R]\f[I]name\f[R]\f[CB]=\f[R]\f[I]value\f[R] or 431 \f[CB]\-\-\f[R]\f[I]name\f[R] \f[I]value\f[R]. 432 .RE 433 .TP 434 .B \f[CB]\-agentlib:\f[R]\f[I]libname\f[R][\f[CB]=\f[R]\f[I]options\f[R]] 435 Loads the specified native agent library. 436 After the library name, a comma\-separated list of options specific to 437 the library can be used. 438 .RS 439 .IP \[bu] 2 440 \f[B]Oracle Solaris, Linux, and macOS:\f[R] If the option 441 \f[CB]\-agentlib:foo\f[R] is specified, then the JVM attempts to load the 442 library named \f[CB]libfoo.so\f[R] in the location specified by the 443 \f[CB]LD_LIBRARY_PATH\f[R] system variable (on macOS this variable is 444 \f[CB]DYLD_LIBRARY_PATH\f[R]). 445 .IP \[bu] 2 446 \f[B]Windows:\f[R] If the option \f[CB]\-agentlib:foo\f[R] is specified, 447 then the JVM attempts to load the library named \f[CB]foo.dll\f[R] in the 448 location specified by the \f[CB]PATH\f[R] system variable. 449 .RS 2 450 .PP 451 The following example shows how to load the Java Debug Wire Protocol 452 (JDWP) library and listen for the socket connection on port 8000, 453 suspending the JVM before the main class loads: 454 .RS 455 .PP 456 \f[CB]\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\f[R] 457 .RE 458 .RE 459 .RE 460 .TP 461 .B \f[CB]\-agentpath:\f[R]\f[I]pathname\f[R][\f[CB]=\f[R]\f[I]options\f[R]] 462 Loads the native agent library specified by the absolute path name. 463 This option is equivalent to \f[CB]\-agentlib\f[R] but uses the full path 464 and file name of the library. 465 .RS 466 .RE 467 .TP 468 .B \f[CB]\-\-class\-path\f[R] \f[I]classpath\f[R], \f[CB]\-classpath\f[R] \f[I]classpath\f[R], or \f[CB]\-cp\f[R] \f[I]classpath\f[R] 469 A semicolon (\f[CB];\f[R]) separated list of directories, JAR archives, 470 and ZIP archives to search for class files. 471 .RS 472 .PP 473 Specifying \f[I]classpath\f[R] overrides any setting of the 474 \f[CB]CLASSPATH\f[R] environment variable. 475 If the class path option isn\[aq]t used and \f[I]classpath\f[R] isn\[aq]t 476 set, then the user class path consists of the current directory (.). 477 .PP 478 As a special convenience, a class path element that contains a base name 479 of an asterisk (*) is considered equivalent to specifying a list of all 480 the files in the directory with the extension \f[CB]\&.jar\f[R] or 481 \f[CB]\&.JAR\f[R] . 482 A Java program can\[aq]t tell the difference between the two 483 invocations. 484 For example, if the directory mydir contains \f[CB]a.jar\f[R] and 485 \f[CB]b.JAR\f[R], then the class path element mydir/* is expanded to 486 \f[CB]A.jar:b.JAR\f[R], except that the order of JAR files is unspecified. 487 All \f[CB]\&.jar\f[R] files in the specified directory, even hidden ones, 488 are included in the list. 489 A class path entry consisting of an asterisk (*) expands to a list of 490 all the jar files in the current directory. 491 The \f[CB]CLASSPATH\f[R] environment variable, where defined, is similarly 492 expanded. 493 Any class path wildcard expansion that occurs before the Java VM is 494 started. 495 Java programs never see wildcards that aren\[aq]t expanded except by 496 querying the environment, such as by calling 497 \f[CB]System.getenv("CLASSPATH")\f[R]. 498 .RE 499 .TP 500 .B \f[CB]\-\-disable\-\@files\f[R] 501 Can be used anywhere on the command line, including in an argument file, 502 to prevent further \f[CB]\@filename\f[R] expansion. 503 This option stops expanding \f[CB]\@\f[R]\-argfiles after the option. 504 .RS 505 .RE 506 .TP 507 .B \f[CB]\-\-enable\-preview\f[R] 508 Allows classes to depend on \f[B]preview features\f[R] 509 [https://docs.oracle.com/en/java/javase/12/language/index.html#JSLAN\-GUID\-5A82FE0E\-0CA4\-4F1F\-B075\-564874FE2823] 510 of the release. 511 .RS 512 .RE 513 .TP 514 .B \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]... or \f[CB]\-p\f[R] \f[I]modulepath\f[R] 515 A semicolon (\f[CB];\f[R]) separated list of directories in which each 516 directory is a directory of modules. 517 .RS 518 .RE 519 .TP 520 .B \f[CB]\-\-upgrade\-module\-path\f[R] \f[I]modulepath\f[R]... 521 A semicolon (\f[CB];\f[R]) separated list of directories in which each 522 directory is a directory of modules that replace upgradeable modules in 523 the runtime image. 524 .RS 525 .RE 526 .TP 527 .B \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...] 528 Specifies the root modules to resolve in addition to the initial module. 529 \f[I]module\f[R] also can be \f[CB]ALL\-DEFAULT\f[R], \f[CB]ALL\-SYSTEM\f[R], 530 and \f[CB]ALL\-MODULE\-PATH\f[R]. 531 .RS 532 .RE 533 .TP 534 .B \f[CB]\-\-list\-modules\f[R] 535 Lists the observable modules and then exits. 536 .RS 537 .RE 538 .TP 539 .B \f[CB]\-d\f[R] \f[I]module_name\f[R] or \f[CB]\-\-describe\-module\f[R] \f[I]module_name\f[R] 540 Describes a specified module and then exits. 541 .RS 542 .RE 543 .TP 544 .B \f[CB]\-\-dry\-run\f[R] 545 Creates the VM but doesn\[aq]t execute the main method. 546 This \f[CB]\-\-dry\-run\f[R] option might be useful for validating the 547 command\-line options such as the module system configuration. 548 .RS 549 .RE 550 .TP 551 .B \f[CB]\-\-validate\-modules\f[R] 552 Validates all modules and exit. 553 This option is helpful for finding conflicts and other errors with 554 modules on the module path. 555 .RS 556 .RE 557 .TP 558 .B \f[CB]\-D\f[R]\f[I]property\f[R]\f[CB]=\f[R]\f[I]value\f[R] 559 Sets a system property value. 560 The \f[I]property\f[R] variable is a string with no spaces that 561 represents the name of the property. 562 The \f[I]value\f[R] variable is a string that represents the value of the 563 property. 564 If \f[I]value\f[R] is a string with spaces, then enclose it in quotation 565 marks (for example \f[CB]\-Dfoo="foo\ bar"\f[R]). 566 .RS 567 .RE 568 .TP 569 .B \f[CB]\-disableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-da\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] 570 Disables assertions. 571 By default, assertions are disabled in all packages and classes. 572 With no arguments, \f[CB]\-disableassertions\f[R] (\f[CB]\-da\f[R]) disables 573 assertions in all packages and classes. 574 With the \f[I]packagename\f[R] argument ending in \f[CB]\&...\f[R], the 575 switch disables assertions in the specified package and any subpackages. 576 If the argument is simply \f[CB]\&...\f[R], then the switch disables 577 assertions in the unnamed package in the current working directory. 578 With the \f[I]classname\f[R] argument, the switch disables assertions in 579 the specified class. 580 .RS 581 .PP 582 The \f[CB]\-disableassertions\f[R] (\f[CB]\-da\f[R]) option applies to all 583 class loaders and to system classes (which don\[aq]t have a class 584 loader). 585 There\[aq]s one exception to this rule: If the option is provided with 586 no arguments, then it doesn\[aq]t apply to system classes. 587 This makes it easy to disable assertions in all classes except for 588 system classes. 589 The \f[CB]\-disablesystemassertions\f[R] option enables you to disable 590 assertions in all system classes. 591 To explicitly enable assertions in specific packages or classes, use the 592 \f[CB]\-enableassertions\f[R] (\f[CB]\-ea\f[R]) option. 593 Both options can be used at the same time. 594 For example, to run the \f[CB]MyClass\f[R] application with assertions 595 enabled in the package \f[CB]com.wombat.fruitbat\f[R] (and any 596 subpackages) but disabled in the class 597 \f[CB]com.wombat.fruitbat.Brickbat\f[R], use the following command: 598 .RS 599 .PP 600 \f[CB]java\ \-ea:com.wombat.fruitbat...\ \-da:com.wombat.fruitbat.Brickbat\ MyClass\f[R] 601 .RE 602 .RE 603 .TP 604 .B \f[CB]\-disablesystemassertions\f[R] or \f[CB]\-dsa\f[R] 605 Disables assertions in all system classes. 606 .RS 607 .RE 608 .TP 609 .B \f[CB]\-enableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-ea\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] 610 Enables assertions. 611 By default, assertions are disabled in all packages and classes. 612 With no arguments, \f[CB]\-enableassertions\f[R] (\f[CB]\-ea\f[R]) enables 613 assertions in all packages and classes. 614 With the \f[I]packagename\f[R] argument ending in \f[CB]\&...\f[R], the 615 switch enables assertions in the specified package and any subpackages. 616 If the argument is simply \f[CB]\&...\f[R], then the switch enables 617 assertions in the unnamed package in the current working directory. 618 With the \f[I]classname\f[R] argument, the switch enables assertions in 619 the specified class. 620 .RS 621 .PP 622 The \f[CB]\-enableassertions\f[R] (\f[CB]\-ea\f[R]) option applies to all 623 class loaders and to system classes (which don\[aq]t have a class 624 loader). 625 There\[aq]s one exception to this rule: If the option is provided with 626 no arguments, then it doesn\[aq]t apply to system classes. 627 This makes it easy to enable assertions in all classes except for system 628 classes. 629 The \f[CB]\-enablesystemassertions\f[R] option provides a separate switch 630 to enable assertions in all system classes. 631 To explicitly disable assertions in specific packages or classes, use 632 the \f[CB]\-disableassertions\f[R] (\f[CB]\-da\f[R]) option. 633 If a single command contains multiple instances of these switches, then 634 they\[aq]re processed in order, before loading any classes. 635 For example, to run the \f[CB]MyClass\f[R] application with assertions 636 enabled only in the package \f[CB]com.wombat.fruitbat\f[R] (and any 637 subpackages) but disabled in the class 638 \f[CB]com.wombat.fruitbat.Brickbat\f[R], use the following command: 639 .RS 640 .PP 641 \f[CB]java\ \-ea:com.wombat.fruitbat...\ \-da:com.wombat.fruitbat.Brickbat\ MyClass\f[R] 642 .RE 643 .RE 644 .TP 645 .B \f[CB]\-enablesystemassertions\f[R] or \f[CB]\-esa\f[R] 646 Enables assertions in all system classes. 647 .RS 648 .RE 649 .TP 650 .B \f[CB]\-help\f[R], \f[CB]\-h\f[R], or \f[CB]\-?\f[R] 651 Prints the help message to the error stream. 652 .RS 653 .RE 654 .TP 655 .B \f[CB]\-\-help\f[R] 656 Prints the help message to the output stream. 657 .RS 658 .RE 659 .TP 660 .B \f[CB]\-javaagent:\f[R]\f[I]jarpath\f[R][\f[CB]=\f[R]\f[I]options\f[R]] 661 Loads the specified Java programming language agent. 662 See \f[CB]java.lang.instrument\f[R]. 663 .RS 664 .RE 665 .TP 666 .B \f[CB]\-\-show\-version\f[R] 667 Prints the product version to the output stream and continues. 668 .RS 669 .RE 670 .TP 671 .B \f[CB]\-showversion\f[R] 672 Prints the product version to the error stream and continues. 673 .RS 674 .RE 675 .TP 676 .B \f[CB]\-\-show\-module\-resolution\f[R] 677 Shows module resolution output during startup. 678 .RS 679 .RE 680 .TP 681 .B \f[CB]\-splash:\f[R]\f[I]imagepath\f[R] 682 Shows the splash screen with the image specified by \f[I]imagepath\f[R]. 683 HiDPI scaled images are automatically supported and used if available. 684 The unscaled image file name, such as \f[CB]image.ext\f[R], should always 685 be passed as the argument to the \f[CB]\-splash\f[R] option. 686 The most appropriate scaled image provided is picked up automatically. 687 .RS 688 .PP 689 For example, to show the \f[CB]splash.gif\f[R] file from the 690 \f[CB]images\f[R] directory when starting your application, use the 691 following option: 692 .RS 693 .PP 694 \f[CB]\-splash:images/splash.gif\f[R] 695 .RE 696 .PP 697 See the SplashScreen API documentation for more information. 698 .RE 699 .TP 700 .B \f[CB]\-verbose:class\f[R] 701 Displays information about each loaded class. 702 .RS 703 .RE 704 .TP 705 .B \f[CB]\-verbose:gc\f[R] 706 Displays information about each garbage collection (GC) event. 707 .RS 708 .RE 709 .TP 710 .B \f[CB]\-verbose:jni\f[R] 711 Displays information about the use of native methods and other Java 712 Native Interface (JNI) activity. 713 .RS 714 .RE 715 .TP 716 .B \f[CB]\-verbose:module\f[R] 717 Displays information about the modules in use. 718 .RS 719 .RE 720 .TP 721 .B \f[CB]\-\-version\f[R] 722 Prints product version to the output stream and exits. 723 .RS 724 .RE 725 .TP 726 .B \f[CB]\-version\f[R] 727 Prints product version to the error stream and exits. 728 .RS 729 .RE 730 .TP 731 .B \f[CB]\-X\f[R] 732 Prints the help on extra options to the error stream. 733 .RS 734 .RE 735 .TP 736 .B \f[CB]\-\-help\-extra\f[R] 737 Prints the help on extra options to the output stream. 738 .RS 739 .RE 740 .TP 741 .B \f[CB]\@\f[R]\f[I]argfile\f[R] 742 Specifies one or more argument files prefixed by \f[CB]\@\f[R] used by the 743 \f[CB]java\f[R] command. 744 It isn\[aq]t uncommon for the \f[CB]java\f[R] command line to be very long 745 because of the \f[CB]\&.jar\f[R] files needed in the classpath. 746 The \f[CB]\@\f[R]\f[I]argfile\f[R] option overcomes command\-line length 747 limitations by enabling the launcher to expand the contents of argument 748 files after shell expansion, but before argument processing. 749 Contents in the argument files are expanded because otherwise, they 750 would be specified on the command line until the 751 \f[CB]\-\-disable\-\@files\f[R] option was encountered. 752 .RS 753 .PP 754 The argument files can also contain the main class name and all options. 755 If an argument file contains all of the options required by the 756 \f[CB]java\f[R] command, then the command line could simply be: 757 .RS 758 .PP 759 \f[CB]java\ \@\f[R]\f[I]argfile\f[R] 760 .RE 761 .PP 762 See \f[B]java Command\-Line Argument Files\f[R] for a description and 763 examples of using \f[CB]\@\f[R]\-argfiles. 764 .RE 765 .SH EXTRA OPTIONS FOR JAVA 766 .PP 767 The following \f[CB]java\f[R] options are general purpose options that are 768 specific to the Java HotSpot Virtual Machine. 769 .TP 770 .B \f[CB]\-Xbatch\f[R] 771 Disables background compilation. 772 By default, the JVM compiles the method as a background task, running 773 the method in interpreter mode until the background compilation is 774 finished. 775 The \f[CB]\-Xbatch\f[R] flag disables background compilation so that 776 compilation of all methods proceeds as a foreground task until 777 completed. 778 This option is equivalent to \f[CB]\-XX:\-BackgroundCompilation\f[R]. 779 .RS 780 .RE 781 .TP 782 .B \f[CB]\-Xbootclasspath/a:\f[R]\f[I]directories\f[R]|\f[I]zip\f[R]|\f[I]JAR\-files\f[R] 783 Specifies a list of directories, JAR files, and ZIP archives to append 784 to the end of the default bootstrap class path. 785 .RS 786 .PP 787 \f[B]Oracle Solaris, Linux, and macOS:\f[R] Colons (\f[CB]:\f[R]) separate 788 entities in this list. 789 .PP 790 \f[B]Windows:\f[R] Semicolons (\f[CB];\f[R]) separate entities in this 791 list. 792 .RE 793 .TP 794 .B \f[CB]\-Xcheck:jni\f[R] 795 Performs additional checks for Java Native Interface (JNI) functions. 796 Specifically, it validates the parameters passed to the JNI function and 797 the runtime environment data before processing the JNI request. 798 It also checks for pending exceptions between JNI calls. 799 Any invalid data encountered indicates a problem in the native code, and 800 the JVM terminates with an irrecoverable error in such cases. 801 Expect a performance degradation when this option is used. 802 .RS 803 .RE 804 .TP 805 .B \f[CB]\-Xcomp\f[R] 806 Forces compilation of methods on first invocation. 807 By default, the Client VM (\f[CB]\-client\f[R]) performs 1,000 interpreted 808 method invocations and the Server VM (\f[CB]\-server\f[R]) performs 10,000 809 interpreted method invocations to gather information for efficient 810 compilation. 811 Specifying the \f[CB]\-Xcomp\f[R] option disables interpreted method 812 invocations to increase compilation performance at the expense of 813 efficiency. 814 You can also change the number of interpreted method invocations before 815 compilation using the \f[CB]\-XX:CompileThreshold\f[R] option. 816 .RS 817 .RE 818 .TP 819 .B \f[CB]\-Xdebug\f[R] 820 Does nothing. 821 Provided for backward compatibility. 822 .RS 823 .RE 824 .TP 825 .B \f[CB]\-Xdiag\f[R] 826 Shows additional diagnostic messages. 827 .RS 828 .RE 829 .TP 830 .B \f[CB]\-Xint\f[R] 831 Runs the application in interpreted\-only mode. 832 Compilation to native code is disabled, and all bytecode is executed by 833 the interpreter. 834 The performance benefits offered by the just\-in\-time (JIT) compiler 835 aren\[aq]t present in this mode. 836 .RS 837 .RE 838 .TP 839 .B \f[CB]\-Xinternalversion\f[R] 840 Displays more detailed JVM version information than the 841 \f[CB]\-version\f[R] option, and then exits. 842 .RS 843 .RE 844 .TP 845 .B \f[CB]\-Xlog:\f[R]\f[I]option\f[R] 846 Configure or enable logging with the Java Virtual Machine (JVM) unified 847 logging framework. 848 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R]. 849 .RS 850 .RE 851 .TP 852 .B \f[CB]\-Xmixed\f[R] 853 Executes all bytecode by the interpreter except for hot methods, which 854 are compiled to native code. 855 .RS 856 .RE 857 .TP 858 .B \f[CB]\-Xmn\f[R] \f[I]size\f[R] 859 Sets the initial and maximum size (in bytes) of the heap for the young 860 generation (nursery) in the generational collectors. 861 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 862 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 863 \f[CB]G\f[R] to indicate gigabytes. 864 The young generation region of the heap is used for new objects. 865 GC is performed in this region more often than in other regions. 866 If the size for the young generation is too small, then a lot of minor 867 garbage collections are performed. 868 If the size is too large, then only full garbage collections are 869 performed, which can take a long time to complete. 870 It is recommended that you do not set the size for the young generation 871 for the G1 collector, and keep the size for the young generation greater 872 than 25% and less than 50% of the overall heap size for other 873 collectors. 874 The following examples show how to set the initial and maximum size of 875 young generation to 256 MB using various units: 876 .RS 877 .IP 878 .nf 879 \f[CB] 880 \-Xmn256m 881 \-Xmn262144k 882 \-Xmn268435456 883 \f[R] 884 .fi 885 .PP 886 Instead of the \f[CB]\-Xmn\f[R] option to set both the initial and maximum 887 size of the heap for the young generation, you can use 888 \f[CB]\-XX:NewSize\f[R] to set the initial size and 889 \f[CB]\-XX:MaxNewSize\f[R] to set the maximum size. 890 .RE 891 .TP 892 .B \f[CB]\-Xms\f[R] \f[I]size\f[R] 893 Sets the minimum and initial size (in bytes) of the heap. 894 This value must be a multiple of 1024 and greater than 1 MB. 895 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 896 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, \f[CB]g\f[R] or \f[CB]G\f[R] 897 to indicate gigabytes. 898 The following examples show how to set the size of allocated memory to 6 899 MB using various units: 900 .RS 901 .IP 902 .nf 903 \f[CB] 904 \-Xms6291456 905 \-Xms6144k 906 \-Xms6m 907 \f[R] 908 .fi 909 .PP 910 Instead of the \f[CB]\-Xms\f[R] option to set both the minimum and initial 911 size of the heap, you can use \f[CB]\-XX:MinHeapSize\f[R] to set the 912 minimum size and \f[CB]\-XX:InitialHeapSize\f[R] to set the initial size. 913 .PP 914 If you don\[aq]t set this option, the initial size is set as the sum of 915 the sizes allocated for the old generation and the young generation. 916 The initial size of the heap for the young generation can be set using 917 the \f[CB]\-Xmn\f[R] option or the \f[CB]\-XX:NewSize\f[R] option. 918 .RE 919 .TP 920 .B \f[CB]\-Xmx\f[R] \f[I]size\f[R] 921 Specifies the maximum size (in bytes) of the heap. 922 This value must be a multiple of 1024 and greater than 2 MB. 923 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 924 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 925 \f[CB]G\f[R] to indicate gigabytes. 926 The default value is chosen at runtime based on system configuration. 927 For server deployments, \f[CB]\-Xms\f[R] and \f[CB]\-Xmx\f[R] are often set 928 to the same value. 929 The following examples show how to set the maximum allowed size of 930 allocated memory to 80 MB using various units: 931 .RS 932 .IP 933 .nf 934 \f[CB] 935 \-Xmx83886080 936 \-Xmx81920k 937 \-Xmx80m 938 \f[R] 939 .fi 940 .PP 941 The \f[CB]\-Xmx\f[R] option is equivalent to \f[CB]\-XX:MaxHeapSize\f[R]. 942 .RE 943 .TP 944 .B \f[CB]\-Xnoclassgc\f[R] 945 Disables garbage collection (GC) of classes. 946 This can save some GC time, which shortens interruptions during the 947 application run. 948 When you specify \f[CB]\-Xnoclassgc\f[R] at startup, the class objects in 949 the application are left untouched during GC and are always be 950 considered live. 951 This can result in more memory being permanently occupied which, if not 952 used carefully, throws an out\-of\-memory exception. 953 .RS 954 .RE 955 .TP 956 .B \f[CB]\-Xrs\f[R] 957 Reduces the use of operating system signals by the JVM. 958 Shutdown hooks enable the orderly shutdown of a Java application by 959 running user cleanup code (such as closing database connections) at 960 shutdown, even if the JVM terminates abruptly. 961 .RS 962 .IP \[bu] 2 963 \f[B]Oracle Solaris, Linux, and macOS:\f[R] 964 .RS 2 965 .IP \[bu] 2 966 The JVM catches signals to implement shutdown hooks for unexpected 967 termination. 968 The JVM uses \f[CB]SIGHUP\f[R], \f[CB]SIGINT\f[R], and \f[CB]SIGTERM\f[R] to 969 initiate the running of shutdown hooks. 970 .IP \[bu] 2 971 Applications embedding the JVM frequently need to trap signals such as 972 \f[CB]SIGINT\f[R] or \f[CB]SIGTERM\f[R], which can lead to interference with 973 the JVM signal handlers. 974 The \f[CB]\-Xrs\f[R] option is available to address this issue. 975 When \f[CB]\-Xrs\f[R] is used, the signal masks for \f[CB]SIGINT\f[R], 976 \f[CB]SIGTERM\f[R], \f[CB]SIGHUP\f[R], and \f[CB]SIGQUIT\f[R] aren\[aq]t 977 changed by the JVM, and signal handlers for these signals aren\[aq]t 978 installed. 979 .RE 980 .IP \[bu] 2 981 \f[B]Windows:\f[R] 982 .RS 2 983 .IP \[bu] 2 984 The JVM watches for console control events to implement shutdown hooks 985 for unexpected termination. 986 Specifically, the JVM registers a console control handler that begins 987 shutdown\-hook processing and returns \f[CB]TRUE\f[R] for 988 \f[CB]CTRL_C_EVENT\f[R], \f[CB]CTRL_CLOSE_EVENT\f[R], 989 \f[CB]CTRL_LOGOFF_EVENT\f[R], and \f[CB]CTRL_SHUTDOWN_EVENT\f[R]. 990 .IP \[bu] 2 991 The JVM uses a similar mechanism to implement the feature of dumping 992 thread stacks for debugging purposes. 993 The JVM uses \f[CB]CTRL_BREAK_EVENT\f[R] to perform thread dumps. 994 .IP \[bu] 2 995 If the JVM is run as a service (for example, as a servlet engine for a 996 web server), then it can receive \f[CB]CTRL_LOGOFF_EVENT\f[R] but 997 shouldn\[aq]t initiate shutdown because the operating system doesn\[aq]t 998 actually terminate the process. 999 To avoid possible interference such as this, the \f[CB]\-Xrs\f[R] option 1000 can be used. 1001 When the \f[CB]\-Xrs\f[R] option is used, the JVM doesn\[aq]t install a 1002 console control handler, implying that it doesn\[aq]t watch for or 1003 process \f[CB]CTRL_C_EVENT\f[R], \f[CB]CTRL_CLOSE_EVENT\f[R], 1004 \f[CB]CTRL_LOGOFF_EVENT\f[R], or \f[CB]CTRL_SHUTDOWN_EVENT\f[R]. 1005 .RE 1006 .PP 1007 There are two consequences of specifying \f[CB]\-Xrs\f[R]: 1008 .IP \[bu] 2 1009 \f[B]Oracle Solaris, Linux, and macOS:\f[R] \f[CB]SIGQUIT\f[R] thread dumps 1010 aren\[aq]t available. 1011 .IP \[bu] 2 1012 \f[B]Windows:\f[R] Ctrl + Break thread dumps aren\[aq]t available. 1013 .PP 1014 User code is responsible for causing shutdown hooks to run, for example, 1015 by calling the \f[CB]System.exit()\f[R] when the JVM is to be terminated. 1016 .RE 1017 .TP 1018 .B \f[CB]\-Xshare:\f[R]\f[I]mode\f[R] 1019 Sets the class data sharing (CDS) mode. 1020 .RS 1021 .PP 1022 Possible \f[I]mode\f[R] arguments for this option include the following: 1023 .TP 1024 .B \f[CB]auto\f[R] 1025 Use shared class data if possible (default). 1026 .RS 1027 .RE 1028 .TP 1029 .B \f[CB]on\f[R] 1030 Require using shared class data, otherwise fail. 1031 .RS 1032 .RE 1033 .RS 1034 .PP 1035 \f[B]Note:\f[R] The \f[CB]\-Xshare:on\f[R] option is used for testing 1036 purposes only and may cause intermittent failures due to the use of 1037 address space layout randomization by the operation system. 1038 This option should not be used in production environments. 1039 .RE 1040 .TP 1041 .B \f[CB]off\f[R] 1042 Do not attempt to use shared class data. 1043 .RS 1044 .RE 1045 .RE 1046 .TP 1047 .B \f[CB]\-XshowSettings\f[R] 1048 Shows all settings and then continues. 1049 .RS 1050 .RE 1051 .TP 1052 .B \f[CB]\-XshowSettings:\f[R]\f[I]category\f[R] 1053 Shows settings and continues. 1054 Possible \f[I]category\f[R] arguments for this option include the 1055 following: 1056 .RS 1057 .TP 1058 .B \f[CB]all\f[R] 1059 Shows all categories of settings. 1060 This is the default value. 1061 .RS 1062 .RE 1063 .TP 1064 .B \f[CB]locale\f[R] 1065 Shows settings related to locale. 1066 .RS 1067 .RE 1068 .TP 1069 .B \f[CB]properties\f[R] 1070 Shows settings related to system properties. 1071 .RS 1072 .RE 1073 .TP 1074 .B \f[CB]vm\f[R] 1075 Shows the settings of the JVM. 1076 .RS 1077 .RE 1078 .TP 1079 .B \f[CB]system\f[R] 1080 \f[B]Linux:\f[R] Shows host system or container configuration and 1081 continues. 1082 .RS 1083 .RE 1084 .RE 1085 .TP 1086 .B \f[CB]\-Xss\f[R] \f[I]size\f[R] 1087 Sets the thread stack size (in bytes). 1088 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate KB, \f[CB]m\f[R] or 1089 \f[CB]M\f[R] to indicate MB, or \f[CB]g\f[R] or \f[CB]G\f[R] to indicate GB. 1090 The default value depends on the platform: 1091 .RS 1092 .IP \[bu] 2 1093 Linux/x64 (64\-bit): 1024 KB 1094 .IP \[bu] 2 1095 macOS (64\-bit): 1024 KB 1096 .IP \[bu] 2 1097 Oracle Solaris (64\-bit): 1024 KB 1098 .IP \[bu] 2 1099 Windows: The default value depends on virtual memory 1100 .PP 1101 The following examples set the thread stack size to 1024 KB in different 1102 units: 1103 .IP 1104 .nf 1105 \f[CB] 1106 \-Xss1m 1107 \-Xss1024k 1108 \-Xss1048576 1109 \f[R] 1110 .fi 1111 .PP 1112 This option is similar to \f[CB]\-XX:ThreadStackSize\f[R]. 1113 .RE 1114 .TP 1115 .B \f[CB]\-\-add\-reads\f[R] \f[I]module\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])* 1116 Updates \f[I]module\f[R] to read the \f[I]target\-module\f[R], regardless 1117 of the module declaration. 1118 \f[I]target\-module\f[R] can be all unnamed to read all unnamed modules. 1119 .RS 1120 .RE 1121 .TP 1122 .B \f[CB]\-\-add\-exports\f[R] \f[I]module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])* 1123 Updates \f[I]module\f[R] to export \f[I]package\f[R] to 1124 \f[I]target\-module\f[R], regardless of module declaration. 1125 The \f[I]target\-module\f[R] can be all unnamed to export to all unnamed 1126 modules. 1127 .RS 1128 .RE 1129 .TP 1130 .B \f[CB]\-\-add\-opens\f[R] \f[I]module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])* 1131 Updates \f[I]module\f[R] to open \f[I]package\f[R] to 1132 \f[I]target\-module\f[R], regardless of module declaration. 1133 .RS 1134 .RE 1135 .TP 1136 .B \f[CB]\-\-illegal\-access=\f[R]\f[I]parameter\f[R] 1137 When present at run time, \f[CB]\-\-illegal\-access=\f[R] takes a keyword 1138 \f[I]parameter\f[R] to specify a mode of operation: 1139 .RS 1140 .RS 1141 .PP 1142 \f[B]Note:\f[R] This option will be removed in a future release. 1143 .RE 1144 .IP \[bu] 2 1145 \f[CB]permit\f[R]: This mode opens each package in each module in the 1146 run\-time image to code in all unnamed modules ( such as code on the 1147 class path), if that package existed in JDK 8. 1148 This enables both static access, (for example, by compiled bytecode, and 1149 deep reflective access) through the platform\[aq]s various reflection 1150 APIs. 1151 The first reflective\-access operation to any such package causes a 1152 warning to be issued. 1153 However, no warnings are issued after the first occurrence. 1154 This single warning describes how to enable further warnings. 1155 This mode is the default for the current JDK but will change in a future 1156 release. 1157 .IP \[bu] 2 1158 \f[CB]warn\f[R]: This mode is identical to \f[CB]permit\f[R] except that a 1159 warning message is issued for each illegal reflective\-access operation. 1160 .IP \[bu] 2 1161 \f[CB]debug\f[R]: This mode is identical to \f[CB]warn\f[R] except that both 1162 a warning message and a stack trace are issued for each illegal 1163 reflective\-access operation. 1164 .IP \[bu] 2 1165 \f[CB]deny\f[R]: This mode disables all illegal\-access operations except 1166 for those enabled by other command\-line options, such as 1167 \f[CB]\-\-add\-opens\f[R]. 1168 This mode will become the default in a future release. 1169 .PP 1170 The default mode, \f[CB]\-\-illegal\-access=permit\f[R], is intended to 1171 make you aware of code on the class path that reflectively accesses any 1172 JDK\-internal APIs at least once. 1173 To learn about all such accesses, you can use the \f[CB]warn\f[R] or the 1174 \f[CB]debug\f[R] modes. 1175 For each library or framework on the class path that requires illegal 1176 access, you have two options: 1177 .IP \[bu] 2 1178 If the component\[aq]s maintainers have already released a fixed version 1179 that no longer uses JDK\-internal APIs then you can consider upgrading 1180 to that version. 1181 .IP \[bu] 2 1182 If the component still needs to be fixed, then you can contact its 1183 maintainers and ask them to replace their use of JDK\-internal APIs with 1184 the proper exported APIs. 1185 .PP 1186 If you must continue to use a component that requires illegal access, 1187 then you can eliminate the warning messages by using one or more 1188 \f[CB]\-\-add\-opens\f[R] options to open only those internal packages to 1189 which access is required. 1190 .PP 1191 To verify that your application is ready for a future version of the 1192 JDK, run it with \f[CB]\-\-illegal\-access=deny\f[R] along with any 1193 necessary \f[CB]\-\-add\-opens\f[R] options. 1194 Any remaining illegal\-access errors will most likely be due to static 1195 references from compiled code to JDK\-internal APIs. 1196 You can identify those by running the \f[B]jdeps\f[R] tool with the 1197 \f[CB]\-\-jdk\-internals\f[R] option. 1198 For performance reasons, the current JDK does not issue warnings for 1199 illegal static\-access operations. 1200 .RE 1201 .TP 1202 .B \f[CB]\-\-limit\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...] 1203 Specifies the limit of the universe of observable modules. 1204 .RS 1205 .RE 1206 .TP 1207 .B \f[CB]\-\-patch\-module\f[R] \f[I]module\f[R]\f[CB]=\f[R]\f[I]file\f[R](\f[CB];\f[R]\f[I]file\f[R])* 1208 Overrides or augments a module with classes and resources in JAR files 1209 or directories. 1210 .RS 1211 .RE 1212 .TP 1213 .B \f[CB]\-\-source\f[R] \f[I]version\f[R] 1214 Sets the version of the source in source\-file mode. 1215 .RS 1216 .RE 1217 .SH EXTRA OPTIONS FOR MACOS 1218 .PP 1219 The following extra options are macOS specific. 1220 .TP 1221 .B \f[CB]\-XstartOnFirstThread\f[R] 1222 Runs the \f[CB]main()\f[R] method on the first (AppKit) thread. 1223 .RS 1224 .RE 1225 .TP 1226 .B \f[CB]\-Xdock:name=\f[R]\f[I]application_name\f[R] 1227 Overrides the default application name displayed in dock. 1228 .RS 1229 .RE 1230 .TP 1231 .B \f[CB]\-Xdock:icon=\f[R]\f[I]path_to_icon_file\f[R] 1232 Overrides the default icon displayed in dock. 1233 .RS 1234 .RE 1235 .SH ADVANCED OPTIONS FOR JAVA 1236 .PP 1237 These \f[CB]java\f[R] options can be used to enable other advanced 1238 options. 1239 .TP 1240 .B \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R] 1241 Unlocks the options intended for diagnosing the JVM. 1242 By default, this option is disabled and diagnostic options aren\[aq]t 1243 available. 1244 .RS 1245 .PP 1246 Command line options that are enabled with the use of this option are 1247 not supported. 1248 If you encounter issues while using any of these options, it is very 1249 likely that you will be required to reproduce the problem without using 1250 any of these unsupported options before Oracle Support can assist with 1251 an investigation. 1252 It is also possible that any of these options may be removed or their 1253 behavior changed without any warning. 1254 .RE 1255 .TP 1256 .B \f[CB]\-XX:+UnlockExperimentalVMOptions\f[R] 1257 Unlocks the options that provide experimental features in the JVM. 1258 By default, this option is disabled and experimental features aren\[aq]t 1259 available. 1260 .RS 1261 .RE 1262 .SH ADVANCED RUNTIME OPTIONS FOR JAVA 1263 .PP 1264 These \f[CB]java\f[R] options control the runtime behavior of the Java 1265 HotSpot VM. 1266 .TP 1267 .B \f[CB]\-XX:ActiveProcessorCount=\f[R]\f[I]x\f[R] 1268 Overrides the number of CPUs that the VM will use to calculate the size 1269 of thread pools it will use for various operations such as Garbage 1270 Collection and ForkJoinPool. 1271 .RS 1272 .PP 1273 The VM normally determines the number of available processors from the 1274 operating system. 1275 This flag can be useful for partitioning CPU resources when running 1276 multiple Java processes in docker containers. 1277 This flag is honored even if \f[CB]UseContainerSupport\f[R] is not 1278 enabled. 1279 See \f[CB]\-XX:\-UseContainerSupport\f[R] for a description of enabling 1280 and disabling container support. 1281 .RE 1282 .TP 1283 .B \f[CB]\-XX:AllocateHeapAt=\f[R]\f[I]path\f[R] 1284 Takes a path to the file system and uses memory mapping to allocate the 1285 object heap on the memory device. 1286 Using this option enables the HotSpot VM to allocate the Java object 1287 heap on an alternative memory device, such as an NV\-DIMM, specified by 1288 the user. 1289 .RS 1290 .PP 1291 Alternative memory devices that have the same semantics as DRAM, 1292 including the semantics of atomic operations, can be used instead of 1293 DRAM for the object heap without changing the existing application code. 1294 All other memory structures (such as the code heap, metaspace, and 1295 thread stacks) continue to reside in DRAM. 1296 .PP 1297 Some operating systems expose non\-DRAM memory through the file system. 1298 Memory\-mapped files in these file systems bypass the page cache and 1299 provide a direct mapping of virtual memory to the physical memory on the 1300 device. 1301 The existing heap related flags (such as \f[CB]\-Xmx\f[R] and 1302 \f[CB]\-Xms\f[R]) and garbage\-collection related flags continue to work 1303 as before. 1304 .RE 1305 .TP 1306 .B \f[CB]\-XX:\-CompactStrings\f[R] 1307 Disables the Compact Strings feature. 1308 By default, this option is enabled. 1309 When this option is enabled, Java Strings containing only single\-byte 1310 characters are internally represented and stored as 1311 single\-byte\-per\-character Strings using ISO\-8859\-1 / Latin\-1 1312 encoding. 1313 This reduces, by 50%, the amount of space required for Strings 1314 containing only single\-byte characters. 1315 For Java Strings containing at least one multibyte character: these are 1316 represented and stored as 2 bytes per character using UTF\-16 encoding. 1317 Disabling the Compact Strings feature forces the use of UTF\-16 encoding 1318 as the internal representation for all Java Strings. 1319 .RS 1320 .PP 1321 Cases where it may be beneficial to disable Compact Strings include the 1322 following: 1323 .IP \[bu] 2 1324 When it\[aq]s known that an application overwhelmingly will be 1325 allocating multibyte character Strings 1326 .IP \[bu] 2 1327 In the unexpected event where a performance regression is observed in 1328 migrating from Java SE 8 to Java SE 9 and an analysis shows that Compact 1329 Strings introduces the regression 1330 .PP 1331 In both of these scenarios, disabling Compact Strings makes sense. 1332 .RE 1333 .TP 1334 .B \f[CB]\-XX:ErrorFile=\f[R]\f[I]filename\f[R] 1335 Specifies the path and file name to which error data is written when an 1336 irrecoverable error occurs. 1337 By default, this file is created in the current working directory and 1338 named \f[CB]hs_err_pid\f[R]\f[I]pid\f[R]\f[CB]\&.log\f[R] where \f[I]pid\f[R] 1339 is the identifier of the process that encountered the error. 1340 .RS 1341 .PP 1342 The following example shows how to set the default log file (note that 1343 the identifier of the process is specified as \f[CB]%p\f[R]): 1344 .RS 1345 .PP 1346 \f[CB]\-XX:ErrorFile=./hs_err_pid%p.log\f[R] 1347 .RE 1348 .IP \[bu] 2 1349 \f[B]Oracle Solaris, Linux, and macOS:\f[R] The following example shows 1350 how to set the error log to \f[CB]/var/log/java/java_error.log\f[R]: 1351 .RS 2 1352 .RS 1353 .PP 1354 \f[CB]\-XX:ErrorFile=/var/log/java/java_error.log\f[R] 1355 .RE 1356 .RE 1357 .IP \[bu] 2 1358 \f[B]Windows:\f[R] The following example shows how to set the error log 1359 file to \f[CB]C:/log/java/java_error.log\f[R]: 1360 .RS 2 1361 .RS 1362 .PP 1363 \f[CB]\-XX:ErrorFile=C:/log/java/java_error.log\f[R] 1364 .RE 1365 .RE 1366 .PP 1367 If the file exists, and is writeable, then it will be overwritten. 1368 Otherwise, if the file can\[aq]t be created in the specified directory 1369 (due to insufficient space, permission problem, or another issue), then 1370 the file is created in the temporary directory for the operating system: 1371 .IP \[bu] 2 1372 \f[B]Oracle Solaris, Linux, and macOS:\f[R] The temporary directory is 1373 \f[CB]/tmp\f[R]. 1374 .IP \[bu] 2 1375 \f[B]Windows:\f[R] The temporary directory is specified by the value of 1376 the \f[CB]TMP\f[R] environment variable; if that environment variable 1377 isn\[aq]t defined, then the value of the \f[CB]TEMP\f[R] environment 1378 variable is used. 1379 .RE 1380 .TP 1381 .B \f[CB]\-XX:+ExtensiveErrorReports\f[R] 1382 Enables the reporting of more extensive error information in the 1383 \f[CB]ErrorFile\f[R]. 1384 This option can be turned on in environments where maximal information 1385 is desired \- even if the resulting logs may be quite large and/or 1386 contain information that might be considered sensitive. 1387 The information can vary from release to release, and across different 1388 platforms. 1389 By default this option is disabled. 1390 .RS 1391 .RE 1392 .TP 1393 .B \f[CB]\-XX:FlightRecorderOptions=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] (or)\f[CB]\-XX:FlightRecorderOptions:\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] 1394 Sets the parameters that control the behavior of JFR. 1395 .RS 1396 .PP 1397 The following list contains the available JFR 1398 \f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] entries: 1399 .TP 1400 .B \f[CB]globalbuffersize=\f[R]\f[I]size\f[R] 1401 Specifies the total amount of primary memory used for data retention. 1402 The default value is based on the value specified for 1403 \f[CB]memorysize\f[R]. 1404 Change the \f[CB]memorysize\f[R] parameter to alter the size of global 1405 buffers. 1406 .RS 1407 .RE 1408 .TP 1409 .B \f[CB]maxchunksize=\f[R]\f[I]size\f[R] 1410 Specifies the maximum size (in bytes) of the data chunks in a recording. 1411 Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes (MB), 1412 or \f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes (GB). 1413 By default, the maximum size of data chunks is set to 12 MB. 1414 The minimum allowed is 1 MB. 1415 .RS 1416 .RE 1417 .TP 1418 .B \f[CB]memorysize=\f[R]\f[I]size\f[R] 1419 Determines how much buffer memory should be used, and sets the 1420 \f[CB]globalbuffersize\f[R] and \f[CB]numglobalbuffers\f[R] parameters based 1421 on the size specified. 1422 Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes (MB), 1423 or \f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes (GB). 1424 By default, the memory size is set to 10 MB. 1425 .RS 1426 .RE 1427 .TP 1428 .B \f[CB]numglobalbuffers\f[R] 1429 Specifies the number of global buffers used. 1430 The default value is based on the memory size specified. 1431 Change the \f[CB]memorysize\f[R] parameter to alter the number of global 1432 buffers. 1433 .RS 1434 .RE 1435 .TP 1436 .B \f[CB]old\-object\-queue\-size=number\-of\-objects\f[R] 1437 Maximum number of old objects to track. 1438 By default, the number of objects is set to 256. 1439 .RS 1440 .RE 1441 .TP 1442 .B \f[CB]repository=\f[R]\f[I]path\f[R] 1443 Specifies the repository (a directory) for temporary disk storage. 1444 By default, the system\[aq]s temporary directory is used. 1445 .RS 1446 .RE 1447 .TP 1448 .B \f[CB]retransform=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]} 1449 Specifies whether event classes should be retransformed using JVMTI. 1450 If false, instrumentation is added when event classes are loaded. 1451 By default, this parameter is enabled. 1452 .RS 1453 .RE 1454 .TP 1455 .B \f[CB]samplethreads=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]} 1456 Specifies whether thread sampling is enabled. 1457 Thread sampling occurs only if the sampling event is enabled along with 1458 this parameter. 1459 By default, this parameter is enabled. 1460 .RS 1461 .RE 1462 .TP 1463 .B \f[CB]stackdepth=\f[R]\f[I]depth\f[R] 1464 Stack depth for stack traces. 1465 By default, the depth is set to 64 method calls. 1466 The maximum is 2048. 1467 Values greater than 64 could create significant overhead and reduce 1468 performance. 1469 .RS 1470 .RE 1471 .TP 1472 .B \f[CB]threadbuffersize=\f[R]\f[I]size\f[R] 1473 Specifies the per\-thread local buffer size (in bytes). 1474 By default, the local buffer size is set to 8 kilobytes, with a minimum 1475 value of 4 kilobytes. 1476 Overriding this parameter could reduce performance and is not 1477 recommended. 1478 .RS 1479 .RE 1480 .PP 1481 You can specify values for multiple parameters by separating them with a 1482 comma. 1483 .RE 1484 .TP 1485 .B \f[CB]\-XX:LargePageSizeInBytes=\f[R]\f[I]size\f[R] 1486 Sets the maximum size (in bytes) for large pages used for the Java heap. 1487 The \f[I]size\f[R] argument must be a power of 2 (2, 4, 8, 16, and so 1488 on). 1489 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 1490 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 1491 \f[CB]G\f[R] to indicate gigabytes. 1492 By default, the size is set to 0, meaning that the JVM chooses the size 1493 for large pages automatically. 1494 See \f[B]Large Pages\f[R]. 1495 .RS 1496 .PP 1497 The following example describes how to set the large page size to 4 1498 megabytes (MB): 1499 .RS 1500 .PP 1501 \f[CB]\-XX:LargePageSizeInBytes=4m\f[R] 1502 .RE 1503 .RE 1504 .TP 1505 .B \f[CB]\-XX:MaxDirectMemorySize=\f[R]\f[I]size\f[R] 1506 Sets the maximum total size (in bytes) of the \f[CB]java.nio\f[R] package, 1507 direct\-buffer allocations. 1508 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 1509 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 1510 \f[CB]G\f[R] to indicate gigabytes. 1511 By default, the size is set to 0, meaning that the JVM chooses the size 1512 for NIO direct\-buffer allocations automatically. 1513 .RS 1514 .PP 1515 The following examples illustrate how to set the NIO size to 1024 KB in 1516 different units: 1517 .IP 1518 .nf 1519 \f[CB] 1520 \-XX:MaxDirectMemorySize=1m 1521 \-XX:MaxDirectMemorySize=1024k 1522 \-XX:MaxDirectMemorySize=1048576 1523 \f[R] 1524 .fi 1525 .RE 1526 .TP 1527 .B \f[CB]\-XX:\-MaxFDLimit\f[R] 1528 Disables the attempt to set the soft limit for the number of open file 1529 descriptors to the hard limit. 1530 By default, this option is enabled on all platforms, but is ignored on 1531 Windows. 1532 The only time that you may need to disable this is on Mac OS, where its 1533 use imposes a maximum of 10240, which is lower than the actual system 1534 maximum. 1535 .RS 1536 .RE 1537 .TP 1538 .B \f[CB]\-XX:NativeMemoryTracking=\f[R]\f[I]mode\f[R] 1539 Specifies the mode for tracking JVM native memory usage. 1540 Possible \f[I]mode\f[R] arguments for this option include the following: 1541 .RS 1542 .TP 1543 .B \f[CB]off\f[R] 1544 Instructs not to track JVM native memory usage. 1545 This is the default behavior if you don\[aq]t specify the 1546 \f[CB]\-XX:NativeMemoryTracking\f[R] option. 1547 .RS 1548 .RE 1549 .TP 1550 .B \f[CB]summary\f[R] 1551 Tracks memory usage only by JVM subsystems, such as Java heap, class, 1552 code, and thread. 1553 .RS 1554 .RE 1555 .TP 1556 .B \f[CB]detail\f[R] 1557 In addition to tracking memory usage by JVM subsystems, track memory 1558 usage by individual \f[CB]CallSite\f[R], individual virtual memory region 1559 and its committed regions. 1560 .RS 1561 .RE 1562 .RE 1563 .TP 1564 .B \f[CB]\-XX:ObjectAlignmentInBytes=\f[R]\f[I]alignment\f[R] 1565 Sets the memory alignment of Java objects (in bytes). 1566 By default, the value is set to 8 bytes. 1567 The specified value should be a power of 2, and must be within the range 1568 of 8 and 256 (inclusive). 1569 This option makes it possible to use compressed pointers with large Java 1570 heap sizes. 1571 .RS 1572 .PP 1573 The heap size limit in bytes is calculated as: 1574 .RS 1575 .PP 1576 \f[CB]4GB\ *\ ObjectAlignmentInBytes\f[R] 1577 .RE 1578 .RS 1579 .PP 1580 \f[B]Note:\f[R] As the alignment value increases, the unused space 1581 between objects also increases. 1582 As a result, you may not realize any benefits from using compressed 1583 pointers with large Java heap sizes. 1584 .RE 1585 .RE 1586 .TP 1587 .B \f[CB]\-XX:OnError=\f[R]\f[I]string\f[R] 1588 Sets a custom command or a series of semicolon\-separated commands to 1589 run when an irrecoverable error occurs. 1590 If the string contains spaces, then it must be enclosed in quotation 1591 marks. 1592 .RS 1593 .IP \[bu] 2 1594 \f[B]Oracle Solaris, Linux, and macOS:\f[R] The following example shows 1595 how the \f[CB]\-XX:OnError\f[R] option can be used to run the 1596 \f[CB]gcore\f[R] command to create a core image, and start the 1597 \f[CB]gdb\f[R] debugger to attach to the process in case of an 1598 irrecoverable error (the \f[CB]%p\f[R] designates the current process 1599 identifier): 1600 .RS 2 1601 .RS 1602 .PP 1603 \f[CB]\-XX:OnError="gcore\ %p;gdb\ \-p\ %p"\f[R] 1604 .RE 1605 .RE 1606 .IP \[bu] 2 1607 \f[B]Windows:\f[R] The following example shows how the 1608 \f[CB]\-XX:OnError\f[R] option can be used to run the 1609 \f[CB]userdump.exe\f[R] utility to obtain a crash dump in case of an 1610 irrecoverable error (the \f[CB]%p\f[R] designates the current process 1611 identifier). 1612 This example assumes that the path to the \f[CB]userdump.exe\f[R] utility 1613 is specified in the \f[CB]PATH\f[R] environment variable: 1614 .RS 2 1615 .RS 1616 .PP 1617 \f[CB]\-XX:OnError="userdump.exe\ %p"\f[R] 1618 .RE 1619 .RE 1620 .RE 1621 .TP 1622 .B \f[CB]\-XX:OnOutOfMemoryError=\f[R]\f[I]string\f[R] 1623 Sets a custom command or a series of semicolon\-separated commands to 1624 run when an \f[CB]OutOfMemoryError\f[R] exception is first thrown. 1625 If the string contains spaces, then it must be enclosed in quotation 1626 marks. 1627 For an example of a command string, see the description of the 1628 \f[CB]\-XX:OnError\f[R] option. 1629 .RS 1630 .RE 1631 .TP 1632 .B \f[CB]\-XX:+PrintCommandLineFlags\f[R] 1633 Enables printing of ergonomically selected JVM flags that appeared on 1634 the command line. 1635 It can be useful to know the ergonomic values set by the JVM, such as 1636 the heap space size and the selected garbage collector. 1637 By default, this option is disabled and flags aren\[aq]t printed. 1638 .RS 1639 .RE 1640 .TP 1641 .B \f[CB]\-XX:+PreserveFramePointer\f[R] 1642 Selects between using the RBP register as a general purpose register 1643 (\f[CB]\-XX:\-PreserveFramePointer\f[R]) and using the RBP register to 1644 hold the frame pointer of the currently executing method 1645 (\f[CB]\-XX:+PreserveFramePointer\f[R] . 1646 If the frame pointer is available, then external profiling tools\ (for 1647 example, Linux perf) can construct more accurate stack traces. 1648 .RS 1649 .RE 1650 .TP 1651 .B \f[CB]\-XX:+PrintNMTStatistics\f[R] 1652 Enables printing of collected native memory tracking data at JVM exit 1653 when native memory tracking is enabled (see 1654 \f[CB]\-XX:NativeMemoryTracking\f[R]). 1655 By default, this option is disabled and native memory tracking data 1656 isn\[aq]t printed. 1657 .RS 1658 .RE 1659 .TP 1660 .B \f[CB]\-XX:SharedArchiveFile=\f[R]\f[I]path\f[R] 1661 Specifies the path and name of the class data sharing (CDS) archive file 1662 .RS 1663 .PP 1664 See \f[B]Application Class Data Sharing\f[R]. 1665 .RE 1666 .TP 1667 .B \f[CB]\-XX:SharedArchiveConfigFile\f[R]=\f[I]shared_config_file\f[R] 1668 Specifies additional shared data added to the archive file. 1669 .RS 1670 .RE 1671 .TP 1672 .B \f[CB]\-XX:SharedClassListFile=\f[R]\f[I]file_name\f[R] 1673 Specifies the text file that contains the names of the classes to store 1674 in the class data sharing (CDS) archive. 1675 This file contains the full name of one class per line, except slashes 1676 (\f[CB]/\f[R]) replace dots (\f[CB]\&.\f[R]). 1677 For example, to specify the classes \f[CB]java.lang.Object\f[R] and 1678 \f[CB]hello.Main\f[R], create a text file that contains the following two 1679 lines: 1680 .RS 1681 .IP 1682 .nf 1683 \f[CB] 1684 java/lang/Object 1685 hello/Main 1686 \f[R] 1687 .fi 1688 .PP 1689 The classes that you specify in this text file should include the 1690 classes that are commonly used by the application. 1691 They may include any classes from the application, extension, or 1692 bootstrap class paths. 1693 .PP 1694 See \f[B]Application Class Data Sharing\f[R]. 1695 .RE 1696 .TP 1697 .B \f[CB]\-XX:+ShowMessageBoxOnError\f[R] 1698 Enables the display of a dialog box when the JVM experiences an 1699 irrecoverable error. 1700 This prevents the JVM from exiting and keeps the process active so that 1701 you can attach a debugger to it to investigate the cause of the error. 1702 By default, this option is disabled. 1703 .RS 1704 .RE 1705 .TP 1706 .B \f[CB]\-XX:StartFlightRecording=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] 1707 Starts a JFR recording for the Java application. 1708 This option is equivalent to the \f[CB]JFR.start\f[R] diagnostic command 1709 that starts a recording during runtime. 1710 You can set the following \f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] 1711 entries when starting a JFR recording: 1712 .RS 1713 .TP 1714 .B \f[CB]delay=\f[R]\f[I]time\f[R] 1715 Specifies the delay between the Java application launch time and the 1716 start of the recording. 1717 Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for 1718 minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example, 1719 specifying \f[CB]10m\f[R] means 10 minutes). 1720 By default, there\[aq]s no delay, and this parameter is set to 0. 1721 .RS 1722 .RE 1723 .TP 1724 .B \f[CB]disk=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]} 1725 Specifies whether to write data to disk while recording. 1726 By default, this parameter is enabled. 1727 .RS 1728 .RE 1729 .TP 1730 .B \f[CB]dumponexit=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]} 1731 Specifies if the running recording is dumped when the JVM shuts down. 1732 If enabled and a \f[CB]filename\f[R] is not entered, the recording is 1733 written to a file in the directory where the process was started. 1734 The file name is a system\-generated name that contains the process ID, 1735 recording ID, and current timestamp, similar to 1736 \f[CB]hotspot\-pid\-47496\-id\-1\-2018_01_25_19_10_41.jfr\f[R]. 1737 By default, this parameter is disabled. 1738 .RS 1739 .RE 1740 .TP 1741 .B \f[CB]duration=\f[R]\f[I]time\f[R] 1742 Specifies the duration of the recording. 1743 Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for 1744 minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example, 1745 specifying \f[CB]5h\f[R] means 5 hours). 1746 By default, the duration isn\[aq]t limited, and this parameter is set to 1747 0. 1748 .RS 1749 .RE 1750 .TP 1751 .B \f[CB]filename=\f[R]\f[I]path\f[R] 1752 Specifies the path and name of the file to which the recording is 1753 written when the recording is stopped, for example: 1754 .RS 1755 .IP \[bu] 2 1756 \f[CB]recording.jfr\f[R] 1757 .IP \[bu] 2 1758 \f[CB]/home/user/recordings/recording.jfr\f[R] 1759 .IP \[bu] 2 1760 \f[CB]c:\\recordings\\recording.jfr\f[R] 1761 .RE 1762 .TP 1763 .B \f[CB]name=\f[R]\f[I]identifier\f[R] 1764 Takes both the name and the identifier of a recording. 1765 .RS 1766 .RE 1767 .TP 1768 .B \f[CB]maxage=\f[R]\f[I]time\f[R] 1769 Specifies the maximum age of disk data to keep for the recording. 1770 This parameter is valid only when the \f[CB]disk\f[R] parameter is set to 1771 \f[CB]true\f[R]. 1772 Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for 1773 minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example, 1774 specifying \f[CB]30s\f[R] means 30 seconds). 1775 By default, the maximum age isn\[aq]t limited, and this parameter is set 1776 to \f[CB]0s\f[R]. 1777 .RS 1778 .RE 1779 .TP 1780 .B \f[CB]maxsize=\f[R]\f[I]size\f[R] 1781 Specifies the maximum size (in bytes) of disk data to keep for the 1782 recording. 1783 This parameter is valid only when the \f[CB]disk\f[R] parameter is set to 1784 \f[CB]true\f[R]. 1785 The value must not be less than the value for the \f[CB]maxchunksize\f[R] 1786 parameter set with \f[CB]\-XX:FlightRecorderOptions\f[R]. 1787 Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes, or 1788 \f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes. 1789 By default, the maximum size of disk data isn\[aq]t limited, and this 1790 parameter is set to \f[CB]0\f[R]. 1791 .RS 1792 .RE 1793 .TP 1794 .B \f[CB]path\-to\-gc\-roots=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]} 1795 Specifies whether to collect the path to garbage collection (GC) roots 1796 at the end of a recording. 1797 By default, this parameter is disabled. 1798 .RS 1799 .PP 1800 The path to GC roots is useful for finding memory leaks, but collecting 1801 it is time\-consuming. 1802 Enable this option only when you start a recording for an application 1803 that you suspect has a memory leak. 1804 If the \f[CB]settings\f[R] parameter is set to \f[CB]profile\f[R], the stack 1805 trace from where the potential leaking object was allocated is included 1806 in the information collected. 1807 .RE 1808 .TP 1809 .B \f[CB]settings=\f[R]\f[I]path\f[R] 1810 Specifies the path and name of the event settings file (of type JFC). 1811 By default, the \f[CB]default.jfc\f[R] file is used, which is located in 1812 \f[CB]JRE_HOME/lib/jfr\f[R]. 1813 This default settings file collects a predefined set of information with 1814 low overhead, so it has minimal impact on performance and can be used 1815 with recordings that run continuously. 1816 .RS 1817 .PP 1818 A second settings file is also provided, profile.jfc, which provides 1819 more data than the default configuration, but can have more overhead and 1820 impact performance. 1821 Use this configuration for short periods of time when more information 1822 is needed. 1823 .RE 1824 .PP 1825 You can specify values for multiple parameters by separating them with a 1826 comma. 1827 .RE 1828 .TP 1829 .B \f[CB]\-XX:ThreadStackSize=\f[R]\f[I]size\f[R] 1830 Sets the Java thread stack size (in kilobytes). 1831 Use of a scaling suffix, such as \f[CB]k\f[R], results in the scaling of 1832 the kilobytes value so that \f[CB]\-XX:ThreadStackSize=1k\f[R] sets the 1833 Java thread stack size\ to 1024*1024 bytes or 1 megabyte. 1834 The default value depends on the platform: 1835 .RS 1836 .IP \[bu] 2 1837 Linux/x64 (64\-bit): 1024 KB 1838 .IP \[bu] 2 1839 macOS (64\-bit): 1024 KB 1840 .IP \[bu] 2 1841 Oracle Solaris (64\-bit): 1024 KB 1842 .IP \[bu] 2 1843 Windows: The default value depends on virtual memory 1844 .PP 1845 The following examples show how to set the thread stack size to 1 1846 megabyte in different units: 1847 .IP 1848 .nf 1849 \f[CB] 1850 \-XX:ThreadStackSize=1k 1851 \-XX:ThreadStackSize=1024 1852 \f[R] 1853 .fi 1854 .PP 1855 This option is similar to \f[CB]\-Xss\f[R]. 1856 .RE 1857 .TP 1858 .B \f[CB]\-XX:\-UseBiasedLocking\f[R] 1859 Disables the use of biased locking. 1860 Some applications with significant amounts of uncontended 1861 synchronization may attain significant speedups with this flag enabled, 1862 but applications with certain patterns of locking may see slowdowns. 1863 \&. 1864 .RS 1865 .PP 1866 By default, this option is enabled. 1867 .RE 1868 .TP 1869 .B \f[CB]\-XX:\-UseCompressedOops\f[R] 1870 Disables the use of compressed pointers. 1871 By default, this option is enabled, and compressed pointers are used. 1872 This will automatically limit the maximum ergonomically determined Java 1873 heap size to the maximum amount of memory that can be covered by 1874 compressed pointers. 1875 By default this range is 32 GB. 1876 .RS 1877 .PP 1878 With compressed oops enabled, object references are represented as 1879 32\-bit offsets instead of 64\-bit pointers, which typically increases 1880 performance when running the application with Java heap sizes smaller 1881 than the compressed oops pointer range. 1882 This option works only for 64\-bit JVMs. 1883 .PP 1884 It\[aq]s possible to use compressed pointers with Java heap sizes 1885 greater than 32 GB. 1886 See the \f[CB]\-XX:ObjectAlignmentInBytes\f[R] option. 1887 .RE 1888 .TP 1889 .B \f[CB]\-XX:\-UseContainerSupport\f[R] 1890 The VM now provides automatic container detection support, which allows 1891 the VM to determine the amount of memory and number of processors that 1892 are available to a Java process running in docker containers. 1893 It uses this information to allocate system resources. 1894 This support is only available on Linux x64 platforms. 1895 \ If supported, the default for this flag is\ \f[CB]true\f[R], and 1896 container support is enabled by default. 1897 \ It\ can be disabled with\ \f[CB]\-XX:\-UseContainerSupport\f[R]. 1898 .RS 1899 .PP 1900 Unified Logging is available to help to diagnose issues related to this 1901 support. 1902 .PP 1903 Use \f[CB]\-Xlog:os+container=trace\f[R] for maximum logging of container 1904 information. 1905 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R] for a 1906 description of using Unified Logging. 1907 .RE 1908 .TP 1909 .B \f[CB]\-XX:+UseHugeTLBFS\f[R] 1910 \f[B]Linux only:\f[R] This option is the equivalent of specifying 1911 \f[CB]\-XX:+UseLargePages\f[R]. 1912 This option is disabled by default. 1913 This option pre\-allocates all large pages up\-front, when memory is 1914 reserved; consequently the JVM can\[aq]t dynamically grow or shrink 1915 large pages memory areas; see \f[CB]\-XX:UseTransparentHugePages\f[R] if 1916 you want this behavior. 1917 .RS 1918 .PP 1919 See \f[B]Large Pages\f[R]. 1920 .RE 1921 .TP 1922 .B \f[CB]\-XX:+UseLargePages\f[R] 1923 Enables the use of large page memory. 1924 By default, this option is disabled and large page memory isn\[aq]t 1925 used. 1926 .RS 1927 .PP 1928 See \f[B]Large Pages\f[R]. 1929 .RE 1930 .TP 1931 .B \f[CB]\-XX:+UseTransparentHugePages\f[R] 1932 \f[B]Linux only:\f[R] Enables the use of large pages that can dynamically 1933 grow or shrink. 1934 This option is disabled by default. 1935 You may encounter performance problems with transparent huge pages as 1936 the OS moves other pages around to create huge pages; this option is 1937 made available for experimentation. 1938 .RS 1939 .RE 1940 .TP 1941 .B \f[CB]\-XX:+AllowUserSignalHandlers\f[R] 1942 Enables installation of signal handlers by the application. 1943 By default, this option is disabled and the application isn\[aq]t 1944 allowed to install signal handlers. 1945 .RS 1946 .RE 1947 .TP 1948 .B \f[CB]\-XX:VMOptionsFile=\f[R]\f[I]filename\f[R] 1949 Allows user to specify VM options in a file, for example, 1950 \f[CB]java\ \-XX:VMOptionsFile=/var/my_vm_options\ HelloWorld\f[R]. 1951 .RS 1952 .RE 1953 .SH ADVANCED JIT COMPILER OPTIONS FOR JAVA 1954 .PP 1955 These \f[CB]java\f[R] options control the dynamic just\-in\-time (JIT) 1956 compilation performed by the Java HotSpot VM. 1957 .TP 1958 .B \f[CB]\-XX:AllocateInstancePrefetchLines=\f[R]\f[I]lines\f[R] 1959 Sets the number of lines to prefetch ahead of the instance allocation 1960 pointer. 1961 By default, the number of lines to prefetch is set to 1: 1962 .RS 1963 .RS 1964 .PP 1965 \f[CB]\-XX:AllocateInstancePrefetchLines=1\f[R] 1966 .RE 1967 .PP 1968 Only the Java HotSpot Server VM supports this option. 1969 .RE 1970 .TP 1971 .B \f[CB]\-XX:AllocatePrefetchDistance=\f[R]\f[I]size\f[R] 1972 Sets the size (in bytes) of the prefetch distance for object allocation. 1973 Memory about to be written with the value of new objects is prefetched 1974 up to this distance starting from the address of the last allocated 1975 object. 1976 Each Java thread has its own allocation point. 1977 .RS 1978 .PP 1979 Negative values denote that prefetch distance is chosen based on the 1980 platform. 1981 Positive values are bytes to prefetch. 1982 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 1983 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 1984 \f[CB]G\f[R] to indicate gigabytes. 1985 The default value is set to \-1. 1986 .PP 1987 The following example shows how to set the prefetch distance to 1024 1988 bytes: 1989 .RS 1990 .PP 1991 \f[CB]\-XX:AllocatePrefetchDistance=1024\f[R] 1992 .RE 1993 .PP 1994 Only the Java HotSpot Server VM supports this option. 1995 .RE 1996 .TP 1997 .B \f[CB]\-XX:AllocatePrefetchInstr=\f[R]\f[I]instruction\f[R] 1998 Sets the prefetch instruction to prefetch ahead of the allocation 1999 pointer. 2000 Only the Java HotSpot Server VM supports this option. 2001 Possible values are from 0 to 3. 2002 The actual instructions behind the values depend on the platform. 2003 By default, the prefetch instruction is set to 0: 2004 .RS 2005 .RS 2006 .PP 2007 \f[CB]\-XX:AllocatePrefetchInstr=0\f[R] 2008 .RE 2009 .PP 2010 Only the Java HotSpot Server VM supports this option. 2011 .RE 2012 .TP 2013 .B \f[CB]\-XX:AllocatePrefetchLines=\f[R]\f[I]lines\f[R] 2014 Sets the number of cache lines to load after the last object allocation 2015 by using the prefetch instructions generated in compiled code. 2016 The default value is 1 if the last allocated object was an instance, and 2017 3 if it was an array. 2018 .RS 2019 .PP 2020 The following example shows how to set the number of loaded cache lines 2021 to 5: 2022 .RS 2023 .PP 2024 \f[CB]\-XX:AllocatePrefetchLines=5\f[R] 2025 .RE 2026 .PP 2027 Only the Java HotSpot Server VM supports this option. 2028 .RE 2029 .TP 2030 .B \f[CB]\-XX:AllocatePrefetchStepSize=\f[R]\f[I]size\f[R] 2031 Sets the step size (in bytes) for sequential prefetch instructions. 2032 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2033 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, \f[CB]g\f[R] or \f[CB]G\f[R] 2034 to indicate gigabytes. 2035 By default, the step size is set to 16 bytes: 2036 .RS 2037 .RS 2038 .PP 2039 \f[CB]\-XX:AllocatePrefetchStepSize=16\f[R] 2040 .RE 2041 .PP 2042 Only the Java HotSpot Server VM supports this option. 2043 .RE 2044 .TP 2045 .B \f[CB]\-XX:AllocatePrefetchStyle=\f[R]\f[I]style\f[R] 2046 Sets the generated code style for prefetch instructions. 2047 The \f[I]style\f[R] argument is an integer from 0 to 3: 2048 .RS 2049 .TP 2050 .B \f[CB]0\f[R] 2051 Don\[aq]t generate prefetch instructions. 2052 .RS 2053 .RE 2054 .TP 2055 .B \f[CB]1\f[R] 2056 Execute prefetch instructions after each allocation. 2057 This is the default parameter. 2058 .RS 2059 .RE 2060 .TP 2061 .B \f[CB]2\f[R] 2062 Use the thread\-local allocation block (TLAB) watermark pointer to 2063 determine when prefetch instructions are executed. 2064 .RS 2065 .RE 2066 .TP 2067 .B \f[CB]3\f[R] 2068 Use BIS instruction on SPARC for allocation prefetch. 2069 .RS 2070 .RE 2071 .PP 2072 Only the Java HotSpot Server VM supports this option. 2073 .RE 2074 .TP 2075 .B \f[CB]\-XX:+BackgroundCompilation\f[R] 2076 Enables background compilation. 2077 This option is enabled by default. 2078 To disable background compilation, specify 2079 \f[CB]\-XX:\-BackgroundCompilation\f[R] (this is equivalent to specifying 2080 \f[CB]\-Xbatch\f[R]). 2081 .RS 2082 .RE 2083 .TP 2084 .B \f[CB]\-XX:CICompilerCount=\f[R]\f[I]threads\f[R] 2085 Sets the number of compiler threads to use for compilation. 2086 By default, the number of threads is set to 2 for the server JVM, to 1 2087 for the client JVM, and it scales to the number of cores if tiered 2088 compilation is used. 2089 The following example shows how to set the number of threads to 2: 2090 .RS 2091 .RS 2092 .PP 2093 \f[CB]\-XX:CICompilerCount=2\f[R] 2094 .RE 2095 .RE 2096 .TP 2097 .B \f[CB]\-XX:CompileCommand=\f[R]\f[I]command\f[R]\f[CB],\f[R]\f[I]method\f[R][\f[CB],\f[R]\f[I]option\f[R]] 2098 Specifies a \f[I]command\f[R] to perform on a \f[I]method\f[R]. 2099 For example, to exclude the \f[CB]indexOf()\f[R] method of the 2100 \f[CB]String\f[R] class from being compiled, use the following: 2101 .RS 2102 .RS 2103 .PP 2104 \f[CB]\-XX:CompileCommand=exclude,java/lang/String.indexOf\f[R] 2105 .RE 2106 .PP 2107 Note that the full class name is specified, including all packages and 2108 subpackages separated by a slash (\f[CB]/\f[R]). 2109 For easier cut\-and\-paste operations, it\[aq]s also possible to use the 2110 method name format produced by the \f[CB]\-XX:+PrintCompilation\f[R] and 2111 \f[CB]\-XX:+LogCompilation\f[R] options: 2112 .RS 2113 .PP 2114 \f[CB]\-XX:CompileCommand=exclude,java.lang.String::indexOf\f[R] 2115 .RE 2116 .PP 2117 If the method is specified without the signature, then the command is 2118 applied to all methods with the specified name. 2119 However, you can also specify the signature of the method in the class 2120 file format. 2121 In this case, you should enclose the arguments in quotation marks, 2122 because otherwise the shell treats the semicolon as a command end. 2123 For example, if you want to exclude only the \f[CB]indexOf(String)\f[R] 2124 method of the \f[CB]String\f[R] class from being compiled, use the 2125 following: 2126 .RS 2127 .PP 2128 \f[CB]\-XX:CompileCommand="exclude,java/lang/String.indexOf,(Ljava/lang/String;)I"\f[R] 2129 .RE 2130 .PP 2131 You can also use the asterisk (*) as a wildcard for class and method 2132 names. 2133 For example, to exclude all \f[CB]indexOf()\f[R] methods in all classes 2134 from being compiled, use the following: 2135 .RS 2136 .PP 2137 \f[CB]\-XX:CompileCommand=exclude,*.indexOf\f[R] 2138 .RE 2139 .PP 2140 The commas and periods are aliases for spaces, making it easier to pass 2141 compiler commands through a shell. 2142 You can pass arguments to \f[CB]\-XX:CompileCommand\f[R] using spaces as 2143 separators by enclosing the argument in quotation marks: 2144 .RS 2145 .PP 2146 \f[CB]\-XX:CompileCommand="exclude\ java/lang/String\ indexOf"\f[R] 2147 .RE 2148 .PP 2149 Note that after parsing the commands passed on the command line using 2150 the \f[CB]\-XX:CompileCommand\f[R] options, the JIT compiler then reads 2151 commands from the \f[CB]\&.hotspot_compiler\f[R] file. 2152 You can add commands to this file or specify a different file using the 2153 \f[CB]\-XX:CompileCommandFile\f[R] option. 2154 .PP 2155 To add several commands, either specify the \f[CB]\-XX:CompileCommand\f[R] 2156 option multiple times, or separate each argument with the new line 2157 separator (\f[CB]\\n\f[R]). 2158 The following commands are available: 2159 .TP 2160 .B \f[CB]break\f[R] 2161 Sets a breakpoint when debugging the JVM to stop at the beginning of 2162 compilation of the specified method. 2163 .RS 2164 .RE 2165 .TP 2166 .B \f[CB]compileonly\f[R] 2167 Excludes all methods from compilation except for the specified method. 2168 As an alternative, you can use the \f[CB]\-XX:CompileOnly\f[R] option, 2169 which lets you specify several methods. 2170 .RS 2171 .RE 2172 .TP 2173 .B \f[CB]dontinline\f[R] 2174 Prevents inlining of the specified method. 2175 .RS 2176 .RE 2177 .TP 2178 .B \f[CB]exclude\f[R] 2179 Excludes the specified method from compilation. 2180 .RS 2181 .RE 2182 .TP 2183 .B \f[CB]help\f[R] 2184 Prints a help message for the \f[CB]\-XX:CompileCommand\f[R] option. 2185 .RS 2186 .RE 2187 .TP 2188 .B \f[CB]inline\f[R] 2189 Attempts to inline the specified method. 2190 .RS 2191 .RE 2192 .TP 2193 .B \f[CB]log\f[R] 2194 Excludes compilation logging (with the \f[CB]\-XX:+LogCompilation\f[R] 2195 option) for all methods except for the specified method. 2196 By default, logging is performed for all compiled methods. 2197 .RS 2198 .RE 2199 .TP 2200 .B \f[CB]option\f[R] 2201 Passes a JIT compilation option to the specified method in place of the 2202 last argument (\f[CB]option\f[R]). 2203 The compilation option is set at the end, after the method name. 2204 For example, to enable the \f[CB]BlockLayoutByFrequency\f[R] option for 2205 the \f[CB]append()\f[R] method of the \f[CB]StringBuffer\f[R] class, use the 2206 following: 2207 .RS 2208 .RS 2209 .PP 2210 \f[CB]\-XX:CompileCommand=option,java/lang/StringBuffer.append,BlockLayoutByFrequency\f[R] 2211 .RE 2212 .PP 2213 You can specify multiple compilation options, separated by commas or 2214 spaces. 2215 .RE 2216 .TP 2217 .B \f[CB]print\f[R] 2218 Prints generated assembler code after compilation of the specified 2219 method. 2220 .RS 2221 .RE 2222 .TP 2223 .B \f[CB]quiet\f[R] 2224 Instructs not to print the compile commands. 2225 By default, the commands that you specify with the 2226 \f[CB]\-XX:CompileCommand\f[R] option are printed; for example, if you 2227 exclude from compilation the \f[CB]indexOf()\f[R] method of the 2228 \f[CB]String\f[R] class, then the following is printed to standard output: 2229 .RS 2230 .RS 2231 .PP 2232 \f[CB]CompilerOracle:\ exclude\ java/lang/String.indexOf\f[R] 2233 .RE 2234 .PP 2235 You can suppress this by specifying the 2236 \f[CB]\-XX:CompileCommand=quiet\f[R] option before other 2237 \f[CB]\-XX:CompileCommand\f[R] options. 2238 .RE 2239 .RE 2240 .TP 2241 .B \f[CB]\-XX:CompileCommandFile=\f[R]\f[I]filename\f[R] 2242 Sets the file from which JIT compiler commands are read. 2243 By default, the \f[CB]\&.hotspot_compiler\f[R] file is used to store 2244 commands performed by the JIT compiler. 2245 .RS 2246 .PP 2247 Each line in the command file represents a command, a class name, and a 2248 method name for which the command is used. 2249 For example, this line prints assembly code for the \f[CB]toString()\f[R] 2250 method of the \f[CB]String\f[R] class: 2251 .RS 2252 .PP 2253 \f[CB]print\ java/lang/String\ toString\f[R] 2254 .RE 2255 .PP 2256 If you\[aq]re using commands for the JIT compiler to perform on methods, 2257 then see the \f[CB]\-XX:CompileCommand\f[R] option. 2258 .RE 2259 .TP 2260 .B \f[CB]\-XX:CompilerDirectivesFile=\f[R]\f[I]file\f[R] 2261 Adds directives from a file to the directives stack when a program 2262 starts. 2263 See \f[B]Compiler Control\f[R] 2264 [https://docs.oracle.com/en/java/javase/12/vm/compiler\-control1.html#GUID\-94AD8194\-786A\-4F19\-BFFF\-278F8E237F3A]. 2265 .RS 2266 .PP 2267 The \f[CB]\-XX:CompilerDirectivesFile\f[R] option has to be used together 2268 with the \f[CB]\-XX:UnlockDiagnosticVMOptions\f[R] option that unlocks 2269 diagnostic JVM options. 2270 .RE 2271 .TP 2272 .B \f[CB]\-XX:+CompilerDirectivesPrint\f[R] 2273 Prints the directives stack when the program starts or when a new 2274 directive is added. 2275 .RS 2276 .PP 2277 The \f[CB]\-XX:+CompilerDirectivesPrint\f[R] option has to be used 2278 together with the \f[CB]\-XX:UnlockDiagnosticVMOptions\f[R] option that 2279 unlocks diagnostic JVM options. 2280 .RE 2281 .TP 2282 .B \f[CB]\-XX:CompileOnly=\f[R]\f[I]methods\f[R] 2283 Sets the list of methods (separated by commas) to which compilation 2284 should be restricted. 2285 Only the specified methods are compiled. 2286 Specify each method with the full class name (including the packages and 2287 subpackages). 2288 For example, to compile only the \f[CB]length()\f[R] method of the 2289 \f[CB]String\f[R] class and the \f[CB]size()\f[R] method of the 2290 \f[CB]List\f[R] class, use the following: 2291 .RS 2292 .RS 2293 .PP 2294 \f[CB]\-XX:CompileOnly=java/lang/String.length,java/util/List.size\f[R] 2295 .RE 2296 .PP 2297 Note that the full class name is specified, including all packages and 2298 subpackages separated by a slash (\f[CB]/\f[R]). 2299 For easier cut and paste operations, it\[aq]s also possible to use the 2300 method name format produced by the \f[CB]\-XX:+PrintCompilation\f[R] and 2301 \f[CB]\-XX:+LogCompilation\f[R] options: 2302 .RS 2303 .PP 2304 \f[CB]\-XX:CompileOnly=java.lang.String::length,java.util.List::size\f[R] 2305 .RE 2306 .PP 2307 Although wildcards aren\[aq]t supported, you can specify only the class 2308 or package name to compile all methods in that class or package, as well 2309 as specify just the method to compile methods with this name in any 2310 class: 2311 .IP 2312 .nf 2313 \f[CB] 2314 \-XX:CompileOnly=java/lang/String 2315 \-XX:CompileOnly=java/lang 2316 \-XX:CompileOnly=.length 2317 \f[R] 2318 .fi 2319 .RE 2320 .TP 2321 .B \f[CB]\-XX:CompileThreshold=\f[R]\f[I]invocations\f[R] 2322 Sets the number of interpreted method invocations before compilation. 2323 By default, in the server JVM, the JIT compiler performs 10,000 2324 interpreted method invocations to gather information for efficient 2325 compilation. 2326 For the client JVM, the default setting is 1,500 invocations. 2327 This option is ignored when tiered compilation is enabled; see the 2328 option \f[CB]\-XX:\-TieredCompilation\f[R]. 2329 The following example shows how to set the number of interpreted method 2330 invocations to 5,000: 2331 .RS 2332 .RS 2333 .PP 2334 \f[CB]\-XX:CompileThreshold=5000\f[R] 2335 .RE 2336 .PP 2337 You can completely disable interpretation of Java methods before 2338 compilation by specifying the \f[CB]\-Xcomp\f[R] option. 2339 .RE 2340 .TP 2341 .B \f[CB]\-XX:CompileThresholdScaling=\f[R]\f[I]scale\f[R] 2342 Provides unified control of first compilation. 2343 This option controls when methods are first compiled for both the tiered 2344 and the nontiered modes of operation. 2345 The \f[CB]CompileThresholdScaling\f[R] option has an integer value between 2346 0 and +Inf and scales the thresholds corresponding to the current mode 2347 of operation (both tiered and nontiered). 2348 Setting \f[CB]CompileThresholdScaling\f[R] to a value less than 1.0 2349 results in earlier compilation while values greater than 1.0 delay 2350 compilation. 2351 Setting \f[CB]CompileThresholdScaling\f[R] to 0 is equivalent to disabling 2352 compilation. 2353 .RS 2354 .RE 2355 .TP 2356 .B \f[CB]\-XX:+DoEscapeAnalysis\f[R] 2357 Enables the use of escape analysis. 2358 This option is enabled by default. 2359 To disable the use of escape analysis, specify 2360 \f[CB]\-XX:\-DoEscapeAnalysis\f[R]. 2361 Only the Java HotSpot Server VM supports this option. 2362 .RS 2363 .RE 2364 .TP 2365 .B \f[CB]\-XX:InitialCodeCacheSize=\f[R]\f[I]size\f[R] 2366 Sets the initial code cache size (in bytes). 2367 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2368 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 2369 \f[CB]G\f[R] to indicate gigabytes. 2370 The default value is set to 500 KB. 2371 The initial code cache size shouldn\[aq]t be less than the system\[aq]s 2372 minimal memory page size. 2373 The following example shows how to set the initial code cache size to 32 2374 KB: 2375 .RS 2376 .RS 2377 .PP 2378 \f[CB]\-XX:InitialCodeCacheSize=32k\f[R] 2379 .RE 2380 .RE 2381 .TP 2382 .B \f[CB]\-XX:+Inline\f[R] 2383 Enables method inlining. 2384 This option is enabled by default to increase performance. 2385 To disable method inlining, specify \f[CB]\-XX:\-Inline\f[R]. 2386 .RS 2387 .RE 2388 .TP 2389 .B \f[CB]\-XX:InlineSmallCode=\f[R]\f[I]size\f[R] 2390 Sets the maximum code size (in bytes) for compiled methods that should 2391 be inlined. 2392 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2393 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 2394 \f[CB]G\f[R] to indicate gigabytes. 2395 Only compiled methods with the size smaller than the specified size is 2396 inlined. 2397 By default, the maximum code size is set to 1000 bytes: 2398 .RS 2399 .RS 2400 .PP 2401 \f[CB]\-XX:InlineSmallCode=1000\f[R] 2402 .RE 2403 .RE 2404 .TP 2405 .B \f[CB]\-XX:+LogCompilation\f[R] 2406 Enables logging of compilation activity to a file named 2407 \f[CB]hotspot.log\f[R] in the current working directory. 2408 You can specify a different log file path and name using the 2409 \f[CB]\-XX:LogFile\f[R] option. 2410 .RS 2411 .PP 2412 By default, this option is disabled and compilation activity isn\[aq]t 2413 logged. 2414 The \f[CB]\-XX:+LogCompilation\f[R] option has to be used together with 2415 the \f[CB]\-XX:UnlockDiagnosticVMOptions\f[R] option that unlocks 2416 diagnostic JVM options. 2417 .PP 2418 You can enable verbose diagnostic output with a message printed to the 2419 console every time a method is compiled by using the 2420 \f[CB]\-XX:+PrintCompilation\f[R] option. 2421 .RE 2422 .TP 2423 .B \f[CB]\-XX:MaxInlineSize=\f[R]\f[I]size\f[R] 2424 Sets the maximum bytecode size (in bytes) of a method to be inlined. 2425 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2426 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 2427 \f[CB]G\f[R] to indicate gigabytes. 2428 By default, the maximum bytecode size is set to 35 bytes: 2429 .RS 2430 .RS 2431 .PP 2432 \f[CB]\-XX:MaxInlineSize=35\f[R] 2433 .RE 2434 .RE 2435 .TP 2436 .B \f[CB]\-XX:MaxNodeLimit=\f[R]\f[I]nodes\f[R] 2437 Sets the maximum number of nodes to be used during single method 2438 compilation. 2439 By default, the maximum number of nodes is set to 65,000: 2440 .RS 2441 .RS 2442 .PP 2443 \f[CB]\-XX:MaxNodeLimit=65000\f[R] 2444 .RE 2445 .RE 2446 .TP 2447 .B \f[CB]\-XX:NonNMethodCodeHeapSize=\f[R]\f[I]size\f[R] 2448 Sets the size in bytes of the code segment containing nonmethod code. 2449 .RS 2450 .PP 2451 A nonmethod code segment containing nonmethod code, such as compiler 2452 buffers and the bytecode interpreter. 2453 This code type stays in the code cache forever. 2454 This flag is used only if \f[CB]\-XX:SegmentedCodeCache\f[R] is enabled. 2455 .RE 2456 .TP 2457 .B \f[CB]\-XX:NonProfiledCodeHeapSize=\f[R]\f[I]size\f[R] 2458 Sets the size in bytes of the code segment containing nonprofiled 2459 methods. 2460 This flag is used only if \f[CB]\-XX:SegmentedCodeCache\f[R] is enabled. 2461 .RS 2462 .RE 2463 .TP 2464 .B \f[CB]\-XX:MaxTrivialSize=\f[R]\f[I]size\f[R] 2465 Sets the maximum bytecode size (in bytes) of a trivial method to be 2466 inlined. 2467 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2468 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 2469 \f[CB]G\f[R] to indicate gigabytes. 2470 By default, the maximum bytecode size of a trivial method is set to 6 2471 bytes: 2472 .RS 2473 .RS 2474 .PP 2475 \f[CB]\-XX:MaxTrivialSize=6\f[R] 2476 .RE 2477 .RE 2478 .TP 2479 .B \f[CB]\-XX:+OptimizeStringConcat\f[R] 2480 Enables the optimization of \f[CB]String\f[R] concatenation operations. 2481 This option is enabled by default. 2482 To disable the optimization of \f[CB]String\f[R] concatenation operations, 2483 specify \f[CB]\-XX:\-OptimizeStringConcat\f[R]. 2484 Only the Java HotSpot Server VM supports this option. 2485 .RS 2486 .RE 2487 .TP 2488 .B \f[CB]\-XX:+PrintAssembly\f[R] 2489 Enables printing of assembly code for bytecoded and native methods by 2490 using the external \f[CB]hsdis\-<arch>.so\f[R] or \f[CB]\&.dll\f[R] library. 2491 For 64\-bit VM on Windows, it\[aq]s \f[CB]hsdis\-amd64.dll\f[R]. 2492 This lets you to see the generated code, which may help you to diagnose 2493 performance issues. 2494 .RS 2495 .PP 2496 By default, this option is disabled and assembly code isn\[aq]t printed. 2497 The \f[CB]\-XX:+PrintAssembly\f[R] option has to be used together with the 2498 \f[CB]\-XX:UnlockDiagnosticVMOptions\f[R] option that unlocks diagnostic 2499 JVM options. 2500 .RE 2501 .TP 2502 .B \f[CB]\-XX:ProfiledCodeHeapSize=\f[R]\f[I]size\f[R] 2503 Sets the size in bytes of the code segment containing profiled methods. 2504 This flag is used only if \f[CB]\-XX:SegmentedCodeCache\f[R] is enabled. 2505 .RS 2506 .RE 2507 .TP 2508 .B \f[CB]\-XX:+PrintCompilation\f[R] 2509 Enables verbose diagnostic output from the JVM by printing a message to 2510 the console every time a method is compiled. 2511 This lets you to see which methods actually get compiled. 2512 By default, this option is disabled and diagnostic output isn\[aq]t 2513 printed. 2514 .RS 2515 .PP 2516 You can also log compilation activity to a file by using the 2517 \f[CB]\-XX:+LogCompilation\f[R] option. 2518 .RE 2519 .TP 2520 .B \f[CB]\-XX:+PrintInlining\f[R] 2521 Enables printing of inlining decisions. 2522 This let\[aq]s you see which methods are getting inlined. 2523 .RS 2524 .PP 2525 By default, this option is disabled and inlining information isn\[aq]t 2526 printed. 2527 The \f[CB]\-XX:+PrintInlining\f[R] option has to be used together with the 2528 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R] option that unlocks diagnostic 2529 JVM options. 2530 .RE 2531 .TP 2532 .B \f[CB]\-XX:ReservedCodeCacheSize=\f[R]\f[I]size\f[R] 2533 Sets the maximum code cache size (in bytes) for JIT\-compiled code. 2534 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 2535 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 2536 \f[CB]G\f[R] to indicate gigabytes. 2537 The default maximum code cache size is 240 MB; if you disable tiered 2538 compilation with the option \f[CB]\-XX:\-TieredCompilation\f[R], then the 2539 default size is 48 MB. 2540 This option has a limit of 2 GB; otherwise, an error is generated. 2541 The maximum code cache size shouldn\[aq]t be less than the initial code 2542 cache size; see the option \f[CB]\-XX:InitialCodeCacheSize\f[R]. 2543 .RS 2544 .RE 2545 .TP 2546 .B \f[CB]\-XX:RTMAbortRatio=\f[R]\f[I]abort_ratio\f[R] 2547 Specifies the RTM abort ratio is specified as a percentage (%) of all 2548 executed RTM transactions. 2549 If a number of aborted transactions becomes greater than this ratio, 2550 then the compiled code is deoptimized. 2551 This ratio is used when the \f[CB]\-XX:+UseRTMDeopt\f[R] option is 2552 enabled. 2553 The default value of this option is 50. 2554 This means that the compiled code is deoptimized if 50% of all 2555 transactions are aborted. 2556 .RS 2557 .RE 2558 .TP 2559 .B \f[CB]\-XX:RTMRetryCount=\f[R]\f[I]number_of_retries\f[R] 2560 Specifies the number of times that the RTM locking code is retried, when 2561 it is aborted or busy, before falling back to the normal locking 2562 mechanism. 2563 The default value for this option is 5. 2564 The \f[CB]\-XX:UseRTMLocking\f[R] option must be enabled. 2565 .RS 2566 .RE 2567 .TP 2568 .B \f[CB]\-XX:+SegmentedCodeCache\f[R] 2569 Enables segmentation of the code cache. 2570 Without the \f[CB]\-XX:+SegmentedCodeCache\f[R], the code cache consists 2571 of one large segment. 2572 With \f[CB]\-XX:+SegmentedCodeCache\f[R], we have separate segments for 2573 nonmethod, profiled method, and nonprofiled method code. 2574 These segments aren\[aq]t resized at runtime. 2575 The feature is enabled by default if tiered compilation is enabled 2576 (\f[CB]\-XX:+TieredCompilation\f[R] ) and 2577 \f[CB]\-XX:ReservedCodeCacheSize\f[R] >= 240 MB. 2578 The advantages are better control of the memory footprint, reduced code 2579 fragmentation, and better iTLB/iCache behavior due to improved locality. 2580 iTLB/iCache is a CPU\-specific term meaning Instruction Translation 2581 Lookaside Buffer (ITLB). 2582 ICache is an instruction cache in theCPU. 2583 The implementation of the code cache can be found in the file: 2584 \f[CB]/share/vm/code/codeCache.cpp\f[R]. 2585 .RS 2586 .RE 2587 .TP 2588 .B \f[CB]\-XX:StartAggressiveSweepingAt=\f[R]\f[I]percent\f[R] 2589 Forces stack scanning of active methods to aggressively remove unused 2590 code when only the given percentage of the code cache is free. 2591 The default value is 10%. 2592 .RS 2593 .RE 2594 .TP 2595 .B \f[CB]\-XX:\-TieredCompilation\f[R] 2596 Disables the use of tiered compilation. 2597 By default, this option is enabled. 2598 Only the Java HotSpot Server VM supports this option. 2599 .RS 2600 .RE 2601 .TP 2602 .B \f[CB]\-XX:+UseAES\f[R] 2603 Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC 2604 hardware. 2605 Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and 2606 SPARC (T4 and newer) are the supported hardware. 2607 The \f[CB]\-XX:+UseAES\f[R] is used in conjunction with UseAESIntrinsics. 2608 Flags that control intrinsics now require the option 2609 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2610 .RS 2611 .RE 2612 .TP 2613 .B \f[CB]\-XX:+UseAESIntrinsics\f[R] 2614 Enables \f[CB]\-XX:+UseAES\f[R] and \f[CB]\-XX:+UseAESIntrinsics\f[R] flags 2615 by default and are supported only for the Java HotSpot Server VM. 2616 To disable hardware\-based AES intrinsics, specify 2617 \f[CB]\-XX:\-UseAES\ \-XX:\-UseAESIntrinsics\f[R]. 2618 For example, to enable hardware AES, use the following flags: 2619 .RS 2620 .RS 2621 .PP 2622 \f[CB]\-XX:+UseAES\ \-XX:+UseAESIntrinsics\f[R] 2623 .RE 2624 .PP 2625 Flags that control intrinsics now require the option 2626 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2627 To support UseAES and UseAESIntrinsics flags, use the \f[CB]\-server\f[R] 2628 option to select the Java HotSpot Server VM. 2629 These flags aren\[aq]t supported on Client VM. 2630 .RE 2631 .TP 2632 .B \f[CB]\-XX:+UseCMoveUnconditionally\f[R] 2633 Generates CMove (scalar and vector) instructions regardless of 2634 profitability analysis. 2635 .RS 2636 .RE 2637 .TP 2638 .B \f[CB]\-XX:+UseCodeCacheFlushing\f[R] 2639 Enables flushing of the code cache before shutting down the compiler. 2640 This option is enabled by default. 2641 To disable flushing of the code cache before shutting down the compiler, 2642 specify \f[CB]\-XX:\-UseCodeCacheFlushing\f[R]. 2643 .RS 2644 .RE 2645 .TP 2646 .B \f[CB]\-XX:+UseCondCardMark\f[R] 2647 Enables checking if the card is already marked before updating the card 2648 table. 2649 This option is disabled by default. 2650 It should be used only on machines with multiple sockets, where it 2651 increases the performance of Java applications that rely on concurrent 2652 operations. 2653 Only the Java HotSpot Server VM supports this option. 2654 .RS 2655 .RE 2656 .TP 2657 .B \f[CB]\-XX:+UseCountedLoopSafepoints\f[R] 2658 Keeps safepoints in counted loops. 2659 Its default value is false.\ 2660 .RS 2661 .RE 2662 .TP 2663 .B \f[CB]\-XX:+UseFMA\f[R] 2664 Enables hardware\-based FMA intrinsics for hardware where FMA 2665 instructions are available (such as, Intel, SPARC, and ARM64). 2666 FMA intrinsics are generated for the 2667 \f[CB]java.lang.Math.fma(\f[R]\f[I]a\f[R]\f[CB],\f[R] \f[I]b\f[R]\f[CB],\f[R] 2668 \f[I]c\f[R]\f[CB])\f[R] methods that calculate the value of \f[CB](\f[R] 2669 \f[I]a\f[R] \f[CB]*\f[R] \f[I]b\f[R] \f[CB]+\f[R] \f[I]c\f[R] \f[CB])\f[R] 2670 expressions. 2671 .RS 2672 .RE 2673 .TP 2674 .B \f[CB]\-XX:+UseRTMDeopt\f[R] 2675 Autotunes RTM locking depending on the abort ratio. 2676 This ratio is specified by the \f[CB]\-XX:RTMAbortRatio\f[R] option. 2677 If the number of aborted transactions exceeds the abort ratio, then the 2678 method containing the lock is deoptimized and recompiled with all locks 2679 as normal locks. 2680 This option is disabled by default. 2681 The \f[CB]\-XX:+UseRTMLocking\f[R] option must be enabled. 2682 .RS 2683 .RE 2684 .TP 2685 .B \f[CB]\-XX:+UseRTMLocking\f[R] 2686 Generates Restricted Transactional Memory (RTM) locking code for all 2687 inflated locks, with the normal locking mechanism as the fallback 2688 handler. 2689 This option is disabled by default. 2690 Options related to RTM are available only for the Java HotSpot Server VM 2691 on x86 CPUs that support Transactional Synchronization Extensions (TSX). 2692 .RS 2693 .PP 2694 RTM is part of Intel\[aq]s TSX, which is an x86 instruction set 2695 extension and facilitates the creation of multithreaded applications. 2696 RTM introduces the new instructions \f[CB]XBEGIN\f[R], \f[CB]XABORT\f[R], 2697 \f[CB]XEND\f[R], and \f[CB]XTEST\f[R]. 2698 The \f[CB]XBEGIN\f[R] and \f[CB]XEND\f[R] instructions enclose a set of 2699 instructions to run as a transaction. 2700 If no conflict is found when running the transaction, then the memory 2701 and register modifications are committed together at the \f[CB]XEND\f[R] 2702 instruction. 2703 The \f[CB]XABORT\f[R] instruction can be used to explicitly abort a 2704 transaction and the \f[CB]XEND\f[R] instruction checks if a set of 2705 instructions is being run in a transaction. 2706 .PP 2707 A lock on a transaction is inflated when another thread tries to access 2708 the same transaction, thereby blocking the thread that didn\[aq]t 2709 originally request access to the transaction. 2710 RTM requires that a fallback set of operations be specified in case a 2711 transaction aborts or fails. 2712 An RTM lock is a lock that has been delegated to the TSX\[aq]s system. 2713 .PP 2714 RTM improves performance for highly contended locks with low conflict in 2715 a critical region (which is code that must not be accessed by more than 2716 one thread concurrently). 2717 RTM also improves the performance of coarse\-grain locking, which 2718 typically doesn\[aq]t perform well in multithreaded applications. 2719 (Coarse\-grain locking is the strategy of holding locks for long periods 2720 to minimize the overhead of taking and releasing locks, while 2721 fine\-grained locking is the strategy of trying to achieve maximum 2722 parallelism by locking only when necessary and unlocking as soon as 2723 possible.) Also, for lightly contended locks that are used by different 2724 threads, RTM can reduce false cache line sharing, also known as cache 2725 line ping\-pong. 2726 This occurs when multiple threads from different processors are 2727 accessing different resources, but the resources share the same cache 2728 line. 2729 As a result, the processors repeatedly invalidate the cache lines of 2730 other processors, which forces them to read from main memory instead of 2731 their cache. 2732 .RE 2733 .TP 2734 .B \f[CB]\-XX:+UseSHA\f[R] 2735 Enables hardware\-based intrinsics for SHA crypto hash functions for 2736 SPARC hardware. 2737 The \f[CB]UseSHA\f[R] option is used in conjunction with the 2738 \f[CB]UseSHA1Intrinsics\f[R], \f[CB]UseSHA256Intrinsics\f[R], and 2739 \f[CB]UseSHA512Intrinsics\f[R] options. 2740 .RS 2741 .PP 2742 The \f[CB]UseSHA\f[R] and \f[CB]UseSHA*Intrinsics\f[R] flags are enabled by 2743 default, and are supported only for Java HotSpot Server VM 64\-bit on 2744 SPARC T4 and newer. 2745 .PP 2746 This feature is applicable only when using the 2747 \f[CB]sun.security.provider.Sun\f[R] provider for SHA operations. 2748 Flags that control intrinsics now require the option 2749 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2750 .PP 2751 To disable all hardware\-based SHA intrinsics, specify the 2752 \f[CB]\-XX:\-UseSHA\f[R]. 2753 To disable only a particular SHA intrinsic, use the appropriate 2754 corresponding option. 2755 For example: \f[CB]\-XX:\-UseSHA256Intrinsics\f[R]. 2756 .RE 2757 .TP 2758 .B \f[CB]\-XX:+UseSHA1Intrinsics\f[R] 2759 Enables intrinsics for SHA\-1 crypto hash function. 2760 Flags that control intrinsics now require the option 2761 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2762 .RS 2763 .RE 2764 .TP 2765 .B \f[CB]\-XX:+UseSHA256Intrinsics\f[R] 2766 Enables intrinsics for SHA\-224 and SHA\-256 crypto hash functions. 2767 Flags that control intrinsics now require the option 2768 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2769 .RS 2770 .RE 2771 .TP 2772 .B \f[CB]\-XX:+UseSHA512Intrinsics\f[R] 2773 Enables intrinsics for SHA\-384 and SHA\-512 crypto hash functions. 2774 Flags that control intrinsics now require the option 2775 \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]. 2776 .RS 2777 .RE 2778 .TP 2779 .B \f[CB]\-XX:+UseSuperWord\f[R] 2780 Enables the transformation of scalar operations into superword 2781 operations. 2782 Superword is a vectorization optimization. 2783 This option is enabled by default. 2784 To disable the transformation of scalar operations into superword 2785 operations, specify \f[CB]\-XX:\-UseSuperWord\f[R]. 2786 Only the Java HotSpot Server VM supports this option. 2787 .RS 2788 .RE 2789 .SH ADVANCED SERVICEABILITY OPTIONS FOR JAVA 2790 .PP 2791 These \f[CB]java\f[R] options provide the ability to gather system 2792 information and perform extensive debugging. 2793 .TP 2794 .B \f[CB]\-XX:+DisableAttachMechanism\f[R] 2795 Disables the mechanism that lets tools attach to the JVM. 2796 By default, this option is disabled, meaning that the attach mechanism 2797 is enabled and you can use diagnostics and troubleshooting tools such as 2798 \f[CB]jcmd\f[R], \f[CB]jstack\f[R], \f[CB]jmap\f[R], and \f[CB]jinfo\f[R]. 2799 .RS 2800 .RS 2801 .PP 2802 \f[B]Note:\f[R] The tools such as \f[B]jcmd\f[R], \f[B]jinfo\f[R], 2803 \f[B]jmap\f[R], and \f[B]jstack\f[R] shipped with the JDK aren\[aq]t 2804 supported when using the tools from one JDK version to troubleshoot a 2805 different JDK version. 2806 .RE 2807 .RE 2808 .TP 2809 .B \f[CB]\-XX:+ExtendedDTraceProbes\f[R] 2810 \f[B]Oracle Solaris, Linux, and macOS:\f[R] Enables additional 2811 \f[CB]dtrace\f[R] tool probes that affect the performance. 2812 By default, this option is disabled and \f[CB]dtrace\f[R] performs only 2813 standard probes. 2814 .RS 2815 .RE 2816 .TP 2817 .B \f[CB]\-XX:+HeapDumpOnOutOfMemoryError\f[R] 2818 Enables the dumping of the Java heap to a file in the current directory 2819 by using the heap profiler (HPROF) when a 2820 \f[CB]java.lang.OutOfMemoryError\f[R] exception is thrown. 2821 You can explicitly set the heap dump file path and name using the 2822 \f[CB]\-XX:HeapDumpPath\f[R] option. 2823 By default, this option is disabled and the heap isn\[aq]t dumped when 2824 an \f[CB]OutOfMemoryError\f[R] exception is thrown. 2825 .RS 2826 .RE 2827 .TP 2828 .B \f[CB]\-XX:HeapDumpPath=path\f[R] 2829 Sets the path and file name for writing the heap dump provided by the 2830 heap profiler (HPROF) when the \f[CB]\-XX:+HeapDumpOnOutOfMemoryError\f[R] 2831 option is set. 2832 By default, the file is created in the current working directory, and 2833 it\[aq]s named \f[CB]java_pid<pid>.hprof\f[R] where \f[CB]<pid>\f[R] is the 2834 identifier of the process that caused the error. 2835 The following example shows how to set the default file explicitly 2836 (\f[CB]%p\f[R] represents the current process identifier): 2837 .RS 2838 .RS 2839 .PP 2840 \f[CB]\-XX:HeapDumpPath=./java_pid%p.hprof\f[R] 2841 .RE 2842 .IP \[bu] 2 2843 \f[B]Oracle Solaris, Linux, and macOS:\f[R] The following example shows 2844 how to set the heap dump file to 2845 \f[CB]/var/log/java/java_heapdump.hprof\f[R]: 2846 .RS 2 2847 .RS 2848 .PP 2849 \f[CB]\-XX:HeapDumpPath=/var/log/java/java_heapdump.hprof\f[R] 2850 .RE 2851 .RE 2852 .IP \[bu] 2 2853 \f[B]Windows:\f[R] The following example shows how to set the heap dump 2854 file to \f[CB]C:/log/java/java_heapdump.log\f[R]: 2855 .RS 2 2856 .RS 2857 .PP 2858 \f[CB]\-XX:HeapDumpPath=C:/log/java/java_heapdump.log\f[R] 2859 .RE 2860 .RE 2861 .RE 2862 .TP 2863 .B \f[CB]\-XX:LogFile=\f[R]\f[I]path\f[R] 2864 Sets the path and file name to where log data is written. 2865 By default, the file is created in the current working directory, and 2866 it\[aq]s named \f[CB]hotspot.log\f[R]. 2867 .RS 2868 .IP \[bu] 2 2869 \f[B]Oracle Solaris, Linux, and macOS:\f[R] The following example shows 2870 how to set the log file to \f[CB]/var/log/java/hotspot.log\f[R]: 2871 .RS 2 2872 .RS 2873 .PP 2874 \f[CB]\-XX:LogFile=/var/log/java/hotspot.log\f[R] 2875 .RE 2876 .RE 2877 .IP \[bu] 2 2878 \f[B]Windows:\f[R] The following example shows how to set the log file to 2879 \f[CB]C:/log/java/hotspot.log\f[R]: 2880 .RS 2 2881 .RS 2882 .PP 2883 \f[CB]\-XX:LogFile=C:/log/java/hotspot.log\f[R] 2884 .RE 2885 .RE 2886 .RE 2887 .TP 2888 .B \f[CB]\-XX:+PrintClassHistogram\f[R] 2889 Enables printing of a class instance histogram after one of the 2890 following events: 2891 .RS 2892 .IP \[bu] 2 2893 \f[B]Oracle Solaris, Linux, and macOS:\f[R] \f[CB]Control+Break\f[R] 2894 .IP \[bu] 2 2895 \f[B]Windows:\f[R] \f[CB]Control+C\f[R] (\f[CB]SIGTERM\f[R]) 2896 .PP 2897 By default, this option is disabled. 2898 .PP 2899 Setting this option is equivalent to running the \f[CB]jmap\ \-histo\f[R] 2900 command, or the \f[CB]jcmd\f[R] \f[I]pid\f[R] \f[CB]GC.class_histogram\f[R] 2901 command, where \f[I]pid\f[R] is the current Java process identifier. 2902 .RE 2903 .TP 2904 .B \f[CB]\-XX:+PrintConcurrentLocks\f[R] 2905 Enables printing of \f[CB]java.util.concurrent\f[R] locks after one of the 2906 following events: 2907 .RS 2908 .IP \[bu] 2 2909 \f[B]Oracle Solaris, Linux, and macOS:\f[R] \f[CB]Control+Break\f[R] 2910 .IP \[bu] 2 2911 \f[B]Windows:\f[R] \f[CB]Control+C\f[R] (\f[CB]SIGTERM\f[R]) 2912 .PP 2913 By default, this option is disabled. 2914 .PP 2915 Setting this option is equivalent to running the \f[CB]jstack\ \-l\f[R] 2916 command or the \f[CB]jcmd\f[R] \f[I]pid\f[R] \f[CB]Thread.print\ \-l\f[R] 2917 command, where \f[I]pid\f[R] is the current Java process identifier. 2918 .RE 2919 .TP 2920 .B \f[CB]\-XX:+PrintFlagsRanges\f[R] 2921 Prints the range specified and allows automatic testing of the values. 2922 See \f[B]Validate Java Virtual Machine Flag Arguments\f[R]. 2923 .RS 2924 .RE 2925 .TP 2926 .B \f[CB]\-XX:+PerfDataSaveToFile\f[R] 2927 If enabled, saves \f[B]jstat\f[R] binary data when the Java application 2928 exits. 2929 This binary data is saved in a file named 2930 \f[CB]hsperfdata_\f[R]\f[I]pid\f[R], where \f[I]pid\f[R] is the process 2931 identifier of the Java application that you ran. 2932 Use the \f[CB]jstat\f[R] command to display the performance data contained 2933 in this file as follows: 2934 .RS 2935 .RS 2936 .PP 2937 \f[CB]jstat\ \-class\ file:///\f[R]\f[I]path\f[R]\f[CB]/hsperfdata_\f[R]\f[I]pid\f[R] 2938 .RE 2939 .RS 2940 .PP 2941 \f[CB]jstat\ \-gc\ file:///\f[R]\f[I]path\f[R]\f[CB]/hsperfdata_\f[R]\f[I]pid\f[R] 2942 .RE 2943 .RE 2944 .TP 2945 .B \f[CB]\-XX:+UsePerfData\f[R] 2946 Enables the \f[CB]perfdata\f[R] feature. 2947 This option is enabled by default to allow JVM monitoring and 2948 performance testing. 2949 Disabling it suppresses the creation of the \f[CB]hsperfdata_userid\f[R] 2950 directories. 2951 To disable the \f[CB]perfdata\f[R] feature, specify 2952 \f[CB]\-XX:\-UsePerfData\f[R]. 2953 .RS 2954 .RE 2955 .SH ADVANCED GARBAGE COLLECTION OPTIONS FOR JAVA 2956 .PP 2957 These \f[CB]java\f[R] options control how garbage collection (GC) is 2958 performed by the Java HotSpot VM. 2959 .TP 2960 .B \f[CB]\-XX:+AggressiveHeap\f[R] 2961 Enables Java heap optimization. 2962 This sets various parameters to be optimal for long\-running jobs with 2963 intensive memory allocation, based on the configuration of the computer 2964 (RAM and CPU). 2965 By default, the option is disabled and the heap sizes are configured 2966 less aggressively. 2967 .RS 2968 .RE 2969 .TP 2970 .B \f[CB]\-XX:+AlwaysPreTouch\f[R] 2971 Requests the VM to touch every page on the Java heap after requesting it 2972 from the operating system and before handing memory out to the 2973 application. 2974 By default, this option is disabled and all pages are committed as the 2975 application uses the heap space. 2976 .RS 2977 .RE 2978 .TP 2979 .B \f[CB]\-XX:+CMSClassUnloadingEnabled\f[R] 2980 Enables class unloading when using the concurrent mark\-sweep (CMS) 2981 garbage collector. 2982 This option is enabled by default. 2983 To disable class unloading for the CMS garbage collector, specify 2984 \f[CB]\-XX:\-CMSClassUnloadingEnabled\f[R]. 2985 .RS 2986 .RE 2987 .TP 2988 .B \f[CB]\-XX:CMSExpAvgFactor=\f[R]\f[I]percent\f[R] 2989 Sets the percentage of time (0 to 100) used to weight the current sample 2990 when computing exponential averages for the concurrent collection 2991 statistics. 2992 By default, the exponential averages factor is set to 25%. 2993 The following example shows how to set the factor to 15%: 2994 .RS 2995 .RS 2996 .PP 2997 \f[CB]\-XX:CMSExpAvgFactor=15\f[R] 2998 .RE 2999 .RE 3000 .TP 3001 .B \f[CB]\-XX:CMSInitiatingOccupancyFraction=\f[R]\f[I]percent\f[R] 3002 Sets the percentage of the old generation occupancy (0 to 100) at which 3003 to start a CMS collection cycle. 3004 The default value is set to \-1. 3005 Any negative value (including the default) implies that the option 3006 \f[CB]\-XX:CMSTriggerRatio\f[R] is used to define the value of the 3007 initiating occupancy fraction. 3008 .RS 3009 .PP 3010 The following example shows how to set the factor to 20%: 3011 .RS 3012 .PP 3013 \f[CB]\-XX:CMSInitiatingOccupancyFraction=20\f[R] 3014 .RE 3015 .RE 3016 .TP 3017 .B \f[CB]\-XX:CMSIncrementalDutySafetyFactor=\f[R]\f[I]percent\f[R] 3018 Sets the percentage (0 to 100) used to add conservatism when computing 3019 the duty cycle. 3020 The default value is 10. 3021 .RS 3022 .RE 3023 .TP 3024 .B \f[CB]\-XX:+CMSScavengeBeforeRemark\f[R] 3025 Enables scavenging attempts before the CMS remark step. 3026 By default, this option is disabled. 3027 .RS 3028 .RE 3029 .TP 3030 .B \f[CB]\-XX:CMSTriggerRatio=percent\f[R] 3031 Sets the percentage (0 to 100) of the value specified by the option 3032 \f[CB]\-XX:MinHeapFreeRatio\f[R] that\[aq]s allocated before a CMS 3033 collection cycle commences. 3034 The default value is set to 80%. 3035 .RS 3036 .PP 3037 The following example shows how to set the occupancy fraction to 75%: 3038 .RS 3039 .PP 3040 \f[CB]\-XX:CMSTriggerRatio=75\f[R] 3041 .RE 3042 .RE 3043 .TP 3044 .B \f[CB]\-XX:ConcGCThreads=\f[R]\f[I]threads\f[R] 3045 Sets the number of threads used for concurrent GC. 3046 Sets \f[I]\f[CI]threads\f[I]\f[R] to approximately 1/4 of the number of 3047 parallel garbage collection threads. 3048 The default value depends on the number of CPUs available to the JVM. 3049 .RS 3050 .PP 3051 For example, to set the number of threads for concurrent GC to 2, 3052 specify the following option: 3053 .RS 3054 .PP 3055 \f[CB]\-XX:ConcGCThreads=2\f[R] 3056 .RE 3057 .RE 3058 .TP 3059 .B \f[CB]\-XX:+DisableExplicitGC\f[R] 3060 Enables the option that disables processing of calls to the 3061 \f[CB]System.gc()\f[R] method. 3062 This option is disabled by default, meaning that calls to 3063 \f[CB]System.gc()\f[R] are processed. 3064 If processing of calls to \f[CB]System.gc()\f[R] is disabled, then the JVM 3065 still performs GC when necessary. 3066 .RS 3067 .RE 3068 .TP 3069 .B \f[CB]\-XX:+ExplicitGCInvokesConcurrent\f[R] 3070 Enables invoking of concurrent GC by using the \f[CB]System.gc()\f[R] 3071 request. 3072 This option is disabled by default and can be enabled only with the 3073 deprecated \f[CB]\-XX:+UseConcMarkSweepGC\f[R] option and the 3074 \f[CB]\-XX:+UseG1GC\f[R] option. 3075 .RS 3076 .RE 3077 .TP 3078 .B \f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples=\f[R]\f[I]number\f[R] 3079 When \f[CB]\-XX:UseAdaptiveIHOP\f[R] is enabled, this option sets the 3080 number of completed marking cycles used to gather samples until G1 3081 adaptively determines the optimum value of 3082 \f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R]. 3083 Before, G1 uses the value of 3084 \f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R] directly for this purpose. 3085 The default value is 3. 3086 .RS 3087 .RE 3088 .TP 3089 .B \f[CB]\-XX:G1HeapRegionSize=size\f[R] 3090 Sets the size of the regions into which the Java heap is subdivided when 3091 using the garbage\-first (G1) collector. 3092 The value is a power of 2 and can range from 1 MB to 32 MB. 3093 The default region size is determined ergonomically based on the heap 3094 size with a goal of approximately 2048 regions. 3095 .RS 3096 .PP 3097 The following example sets the size of the subdivisions to 16 MB: 3098 .RS 3099 .PP 3100 \f[CB]\-XX:G1HeapRegionSize=16m\f[R] 3101 .RE 3102 .RE 3103 .TP 3104 .B \f[CB]\-XX:G1HeapWastePercent=\f[R]\f[I]percent\f[R] 3105 Sets the percentage of heap that you\[aq]re willing to waste. 3106 The Java HotSpot VM doesn\[aq]t initiate the mixed garbage collection 3107 cycle when the reclaimable percentage is less than the heap waste 3108 percentage. 3109 The default is 5 percent. 3110 .RS 3111 .RE 3112 .TP 3113 .B \f[CB]\-XX:G1MaxNewSizePercent=\f[R]\f[I]percent\f[R] 3114 Sets the percentage of the heap size to use as the maximum for the young 3115 generation size. 3116 The default value is 60 percent of your Java heap. 3117 .RS 3118 .PP 3119 This is an experimental flag. 3120 This setting replaces the \f[CB]\-XX:DefaultMaxNewGenPercent\f[R] setting. 3121 .RE 3122 .TP 3123 .B \f[CB]\-XX:G1MixedGCCountTarget=\f[R]\f[I]number\f[R] 3124 Sets the target number of mixed garbage collections after a marking 3125 cycle to collect old regions with at most 3126 \f[CB]G1MixedGCLIveThresholdPercent\f[R] live data. 3127 The default is 8 mixed garbage collections. 3128 The goal for mixed collections is to be within this target number. 3129 .RS 3130 .RE 3131 .TP 3132 .B \f[CB]\-XX:G1MixedGCLiveThresholdPercent=\f[R]\f[I]percent\f[R] 3133 Sets the occupancy threshold for an old region to be included in a mixed 3134 garbage collection cycle. 3135 The default occupancy is 85 percent. 3136 .RS 3137 .PP 3138 This is an experimental flag. 3139 This setting replaces the 3140 \f[CB]\-XX:G1OldCSetRegionLiveThresholdPercent\f[R] setting. 3141 .RE 3142 .TP 3143 .B \f[CB]\-XX:G1NewSizePercent=\f[R]\f[I]percent\f[R] 3144 Sets the percentage of the heap to use as the minimum for the young 3145 generation size. 3146 The default value is 5 percent of your Java heap. 3147 .RS 3148 .PP 3149 This is an experimental flag. 3150 This setting replaces the \f[CB]\-XX:DefaultMinNewGenPercent\f[R] setting. 3151 .RE 3152 .TP 3153 .B \f[CB]\-XX:G1OldCSetRegionThresholdPercent=\f[R]\f[I]percent\f[R] 3154 Sets an upper limit on the number of old regions to be collected during 3155 a mixed garbage collection cycle. 3156 The default is 10 percent of the Java heap. 3157 .RS 3158 .RE 3159 .TP 3160 .B \f[CB]\-XX:G1ReservePercent=\f[R]\f[I]percent\f[R] 3161 Sets the percentage of the heap (0 to 50) that\[aq]s reserved as a false 3162 ceiling to reduce the possibility of promotion failure for the G1 3163 collector. 3164 When you increase or decrease the percentage, ensure that you adjust the 3165 total Java heap by the same amount. 3166 By default, this option is set to 10%. 3167 .RS 3168 .PP 3169 The following example sets the reserved heap to 20%: 3170 .RS 3171 .PP 3172 \f[CB]\-XX:G1ReservePercent=20\f[R] 3173 .RE 3174 .RE 3175 .TP 3176 .B \f[CB]\-XX:+G1UseAdaptiveIHOP\f[R] 3177 Controls adaptive calculation of the old generation occupancy to start 3178 background work preparing for an old generation collection. 3179 If enabled, G1 uses \f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R] for the 3180 first few times as specified by the value of 3181 \f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples\f[R], and after that adaptively 3182 calculates a new optimum value for the initiating occupancy 3183 automatically. 3184 Otherwise, the old generation collection process always starts at the 3185 old generation occupancy determined by 3186 \f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R]. 3187 .RS 3188 .PP 3189 The default is enabled. 3190 .RE 3191 .TP 3192 .B \f[CB]\-XX:InitialHeapSize=\f[R]\f[I]size\f[R] 3193 Sets the initial size (in bytes) of the memory allocation pool. 3194 This value must be either 0, or a multiple of 1024 and greater than 1 3195 MB. 3196 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 3197 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 3198 \f[CB]G\f[R] to indicate gigabytes. 3199 The default value is selected at run time based on the system 3200 configuration. 3201 .RS 3202 .PP 3203 The following examples show how to set the size of allocated memory to 6 3204 MB using various units: 3205 .IP 3206 .nf 3207 \f[CB] 3208 \-XX:InitialHeapSize=6291456 3209 \-XX:InitialHeapSize=6144k 3210 \-XX:InitialHeapSize=6m 3211 \f[R] 3212 .fi 3213 .PP 3214 If you set this option to 0, then the initial size is set as the sum of 3215 the sizes allocated for the old generation and the young generation. 3216 The size of the heap for the young generation can be set using the 3217 \f[CB]\-XX:NewSize\f[R] option. 3218 .RE 3219 .TP 3220 .B \f[CB]\-XX:InitialRAMPercentage=\f[R]\f[I]percent\f[R] 3221 Sets the initial amount of memory that the JVM will use for the Java 3222 heap before applying ergonomics heuristics as a percentage of the 3223 maximum amount determined as described in the \f[CB]\-XX:MaxRAM\f[R] 3224 option. 3225 The default value is 1.5625 percent. 3226 .RS 3227 .PP 3228 The following example shows how to set the percentage of the initial 3229 amount of memory used for the Java heap: 3230 .RS 3231 .PP 3232 \f[CB]\-XX:InitialRAMPercentage=5\f[R] 3233 .RE 3234 .RE 3235 .TP 3236 .B \f[CB]\-XX:InitialSurvivorRatio=\f[R]\f[I]ratio\f[R] 3237 Sets the initial survivor space ratio used by the throughput garbage 3238 collector (which is enabled by the \f[CB]\-XX:+UseParallelGC\f[R] and/or 3239 \f[CB]\-XX:+UseParallelOldGC\f[R] options). 3240 Adaptive sizing is enabled by default with the throughput garbage 3241 collector by using the \f[CB]\-XX:+UseParallelGC\f[R] and 3242 \f[CB]\-XX:+UseParallelOldGC\f[R] options, and the survivor space is 3243 resized according to the application behavior, starting with the initial 3244 value. 3245 If adaptive sizing is disabled (using the 3246 \f[CB]\-XX:\-UseAdaptiveSizePolicy\f[R] option), then the 3247 \f[CB]\-XX:SurvivorRatio\f[R] option should be used to set the size of the 3248 survivor space for the entire execution of the application. 3249 .RS 3250 .PP 3251 The following formula can be used to calculate the initial size of 3252 survivor space (S) based on the size of the young generation (Y), and 3253 the initial survivor space ratio (R): 3254 .RS 3255 .PP 3256 \f[CB]S=Y/(R+2)\f[R] 3257 .RE 3258 .PP 3259 The 2 in the equation denotes two survivor spaces. 3260 The larger the value specified as the initial survivor space ratio, the 3261 smaller the initial survivor space size. 3262 .PP 3263 By default, the initial survivor space ratio is set to 8. 3264 If the default value for the young generation space size is used (2 MB), 3265 then the initial size of the survivor space is 0.2 MB. 3266 .PP 3267 The following example shows how to set the initial survivor space ratio 3268 to 4: 3269 .RS 3270 .PP 3271 \f[CB]\-XX:InitialSurvivorRatio=4\f[R] 3272 .RE 3273 .RE 3274 .TP 3275 .B \f[CB]\-XX:InitiatingHeapOccupancyPercent=\f[R]\f[I]percent\f[R] 3276 Sets the percentage of the old generation occupancy (0 to 100) at which 3277 to start the first few concurrent marking cycles for the G1 garbage 3278 collector. 3279 .RS 3280 .PP 3281 By default, the initiating value is set to 45%. 3282 A value of 0 implies nonstop concurrent GC cycles from the beginning 3283 until G1 adaptively sets this value. 3284 .PP 3285 See also the \f[CB]\-XX:G1UseAdaptiveIHOP\f[R] and 3286 \f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples\f[R] options. 3287 .PP 3288 The following example shows how to set the initiating heap occupancy to 3289 75%: 3290 .RS 3291 .PP 3292 \f[CB]\-XX:InitiatingHeapOccupancyPercent=75\f[R] 3293 .RE 3294 .RE 3295 .TP 3296 .B \f[CB]\-XX:MaxGCPauseMillis=\f[R]\f[I]time\f[R] 3297 Sets a target for the maximum GC pause time (in milliseconds). 3298 This is a soft goal, and the JVM will make its best effort to achieve 3299 it. 3300 The specified value doesn\[aq]t adapt to your heap size. 3301 By default, for G1 the maximum pause time target is 200 milliseconds. 3302 The other generational collectors do not use a pause time goal by 3303 default. 3304 .RS 3305 .PP 3306 The following example shows how to set the maximum target pause time to 3307 500 ms: 3308 .RS 3309 .PP 3310 \f[CB]\-XX:MaxGCPauseMillis=500\f[R] 3311 .RE 3312 .RE 3313 .TP 3314 .B \f[CB]\-XX:MaxHeapSize=\f[R]\f[I]size\f[R] 3315 Sets the maximum size (in byes) of the memory allocation pool. 3316 This value must be a multiple of 1024 and greater than 2 MB. 3317 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 3318 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 3319 \f[CB]G\f[R] to indicate gigabytes. 3320 The default value is selected at run time based on the system 3321 configuration. 3322 For server deployments, the options \f[CB]\-XX:InitialHeapSize\f[R] and 3323 \f[CB]\-XX:MaxHeapSize\f[R] are often set to the same value. 3324 .RS 3325 .PP 3326 The following examples show how to set the maximum allowed size of 3327 allocated memory to 80 MB using various units: 3328 .IP 3329 .nf 3330 \f[CB] 3331 \-XX:MaxHeapSize=83886080 3332 \-XX:MaxHeapSize=81920k 3333 \-XX:MaxHeapSize=80m 3334 \f[R] 3335 .fi 3336 .PP 3337 The \f[CB]\-XX:MaxHeapSize\f[R] option is equivalent to \f[CB]\-Xmx\f[R]. 3338 .RE 3339 .TP 3340 .B \f[CB]\-XX:MaxHeapFreeRatio=\f[R]\f[I]percent\f[R] 3341 Sets the maximum allowed percentage of free heap space (0 to 100) after 3342 a GC event. 3343 If free heap space expands above this value, then the heap is shrunk. 3344 By default, this value is set to 70%. 3345 .RS 3346 .PP 3347 Minimize the Java heap size by lowering the values of the parameters 3348 \f[CB]MaxHeapFreeRatio\f[R] (default value is 70%) and 3349 \f[CB]MinHeapFreeRatio\f[R] (default value is 40%) with the command\-line 3350 options \f[CB]\-XX:MaxHeapFreeRatio\f[R] and 3351 \f[CB]\-XX:MinHeapFreeRatio\f[R]. 3352 Lowering \f[CB]MaxHeapFreeRatio\f[R] to as low as 10% and 3353 \f[CB]MinHeapFreeRatio\f[R] to 5% has successfully reduced the heap size 3354 without too much performance regression; however, results may vary 3355 greatly depending on your application. 3356 Try different values for these parameters until they\[aq]re as low as 3357 possible yet still retain acceptable performance. 3358 .RS 3359 .PP 3360 \f[CB]\-XX:MaxHeapFreeRatio=10\ \-XX:MinHeapFreeRatio=5\f[R] 3361 .RE 3362 .PP 3363 Customers trying to keep the heap small should also add the option 3364 \f[CB]\-XX:\-ShrinkHeapInSteps\f[R]. 3365 See \f[B]Performance Tuning Examples\f[R] for a description of using this 3366 option to keep the Java heap small by reducing the dynamic footprint for 3367 embedded applications. 3368 .RE 3369 .TP 3370 .B \f[CB]\-XX:MaxMetaspaceSize=\f[R]\f[I]size\f[R] 3371 Sets the maximum amount of native memory that can be allocated for class 3372 metadata. 3373 By default, the size isn\[aq]t limited. 3374 The amount of metadata for an application depends on the application 3375 itself, other running applications, and the amount of memory available 3376 on the system. 3377 .RS 3378 .PP 3379 The following example shows how to set the maximum class metadata size 3380 to 256 MB: 3381 .RS 3382 .PP 3383 \f[CB]\-XX:MaxMetaspaceSize=256m\f[R] 3384 .RE 3385 .RE 3386 .TP 3387 .B \f[CB]\-XX:MaxNewSize=\f[R]\f[I]size\f[R] 3388 Sets the maximum size (in bytes) of the heap for the young generation 3389 (nursery). 3390 The default value is set ergonomically. 3391 .RS 3392 .RE 3393 .TP 3394 .B \f[CB]\-XX:MaxRAM=\f[R]\f[I]size\f[R] 3395 Sets the maximum amount of memory that the JVM may use for the Java heap 3396 before applying ergonomics heuristics. 3397 The default value is the maximum amount of available memory to the JVM 3398 process or 128 GB, whichever is lower. 3399 .RS 3400 .PP 3401 The maximum amount of available memory to the JVM process is the minimum 3402 of the machine\[aq]s physical memory and any constraints set by the 3403 environment (e.g. 3404 container). 3405 .PP 3406 Specifying this option disables automatic use of compressed oops if the 3407 combined result of this and other options influencing the maximum amount 3408 of memory is larger than the range of memory addressable by compressed 3409 oops. 3410 See \f[CB]\-XX:UseCompressedOops\f[R] for further information about 3411 compressed oops. 3412 .PP 3413 The following example shows how to set the maximum amount of available 3414 memory for sizing the Java heap to 2 GB: 3415 .RS 3416 .PP 3417 \f[CB]\-XX:MaxRAM=2G\f[R] 3418 .RE 3419 .RE 3420 .TP 3421 .B \f[CB]\-XX:MaxRAMPercentage=\f[R]\f[I]percent\f[R] 3422 Sets the maximum amount of memory that the JVM may use for the Java heap 3423 before applying ergonomics heuristics as a percentage of the maximum 3424 amount determined as described in the \f[CB]\-XX:MaxRAM\f[R] option. 3425 The default value is 25 percent. 3426 .RS 3427 .PP 3428 Specifying this option disables automatic use of compressed oops if the 3429 combined result of this and other options influencing the maximum amount 3430 of memory is larger than the range of memory addressable by compressed 3431 oops. 3432 See \f[CB]\-XX:UseCompressedOops\f[R] for further information about 3433 compressed oops. 3434 .PP 3435 The following example shows how to set the percentage of the maximum 3436 amount of memory used for the Java heap: 3437 .RS 3438 .PP 3439 \f[CB]\-XX:MaxRAMPercentage=75\f[R] 3440 .RE 3441 .RE 3442 .TP 3443 .B \f[CB]\-XX:MinRAMPercentage=\f[R]\f[I]percent\f[R] 3444 Sets the maximum amount of memory that the JVM may use for the Java heap 3445 before applying ergonomics heuristics as a percentage of the maximum 3446 amount determined as described in the \f[CB]\-XX:MaxRAM\f[R] option for 3447 small heaps. 3448 A small heap is a heap of approximately 125 MB. 3449 The default value is 50 percent. 3450 .RS 3451 .PP 3452 The following example shows how to set the percentage of the maximum 3453 amount of memory used for the Java heap for small heaps: 3454 .RS 3455 .PP 3456 \f[CB]\-XX:MinRAMPercentage=75\f[R] 3457 .RE 3458 .RE 3459 .TP 3460 .B \f[CB]\-XX:MaxTenuringThreshold=\f[R]\f[I]threshold\f[R] 3461 Sets the maximum tenuring threshold for use in adaptive GC sizing. 3462 The largest value is 15. 3463 The default value is 15 for the parallel (throughput) collector, and 6 3464 for the CMS collector. 3465 .RS 3466 .PP 3467 The following example shows how to set the maximum tenuring threshold to 3468 10: 3469 .RS 3470 .PP 3471 \f[CB]\-XX:MaxTenuringThreshold=10\f[R] 3472 .RE 3473 .RE 3474 .TP 3475 .B \f[CB]\-XX:MetaspaceSize=\f[R]\f[I]size\f[R] 3476 Sets the size of the allocated class metadata space that triggers a 3477 garbage collection the first time it\[aq]s exceeded. 3478 This threshold for a garbage collection is increased or decreased 3479 depending on the amount of metadata used. 3480 The default size depends on the platform. 3481 .RS 3482 .RE 3483 .TP 3484 .B \f[CB]\-XX:MinHeapFreeRatio=\f[R]\f[I]percent\f[R] 3485 Sets the minimum allowed percentage of free heap space (0 to 100) after 3486 a GC event. 3487 If free heap space falls below this value, then the heap is expanded. 3488 By default, this value is set to 40%. 3489 .RS 3490 .PP 3491 Minimize Java heap size by lowering the values of the parameters 3492 \f[CB]MaxHeapFreeRatio\f[R] (default value is 70%) and 3493 \f[CB]MinHeapFreeRatio\f[R] (default value is 40%) with the command\-line 3494 options \f[CB]\-XX:MaxHeapFreeRatio\f[R] and 3495 \f[CB]\-XX:MinHeapFreeRatio\f[R]. 3496 Lowering \f[CB]MaxHeapFreeRatio\f[R] to as low as 10% and 3497 \f[CB]MinHeapFreeRatio\f[R] to 5% has successfully reduced the heap size 3498 without too much performance regression; however, results may vary 3499 greatly depending on your application. 3500 Try different values for these parameters until they\[aq]re as low as 3501 possible, yet still retain acceptable performance. 3502 .RS 3503 .PP 3504 \f[CB]\-XX:MaxHeapFreeRatio=10\ \-XX:MinHeapFreeRatio=5\f[R] 3505 .RE 3506 .PP 3507 Customers trying to keep the heap small should also add the option 3508 \f[CB]\-XX:\-ShrinkHeapInSteps\f[R]. 3509 See \f[B]Performance Tuning Examples\f[R] for a description of using this 3510 option to keep the Java heap small by reducing the dynamic footprint for 3511 embedded applications. 3512 .RE 3513 .TP 3514 .B \f[CB]\-XX:MinHeapSize=\f[R]\f[I]size\f[R] 3515 Sets the minimum size (in bytes) of the memory allocation pool. 3516 This value must be either 0, or a multiple of 1024 and greater than 1 3517 MB. 3518 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 3519 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 3520 \f[CB]G\f[R] to indicate gigabytes. 3521 The default value is selected at run time based on the system 3522 configuration. 3523 .RS 3524 .PP 3525 The following examples show how to set the mimimum size of allocated 3526 memory to 6 MB using various units: 3527 .IP 3528 .nf 3529 \f[CB] 3530 \-XX:MinHeapSize=6291456 3531 \-XX:MinHeapSize=6144k 3532 \-XX:MinHeapSize=6m 3533 \f[R] 3534 .fi 3535 .PP 3536 If you set this option to 0, then the minimum size is set to the same 3537 value as the initial size. 3538 .RE 3539 .TP 3540 .B \f[CB]\-XX:NewRatio=\f[R]\f[I]ratio\f[R] 3541 Sets the ratio between young and old generation sizes. 3542 By default, this option is set to 2. 3543 The following example shows how to set the young\-to\-old ratio to 1: 3544 .RS 3545 .RS 3546 .PP 3547 \f[CB]\-XX:NewRatio=1\f[R] 3548 .RE 3549 .RE 3550 .TP 3551 .B \f[CB]\-XX:NewSize=\f[R]\f[I]size\f[R] 3552 Sets the initial size (in bytes) of the heap for the young generation 3553 (nursery). 3554 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 3555 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 3556 \f[CB]G\f[R] to indicate gigabytes. 3557 .RS 3558 .PP 3559 The young generation region of the heap is used for new objects. 3560 GC is performed in this region more often than in other regions. 3561 If the size for the young generation is too low, then a large number of 3562 minor GCs are performed. 3563 If the size is too high, then only full GCs are performed, which can 3564 take a long time to complete. 3565 It is recommended that you keep the size for the young generation 3566 greater than 25% and less than 50% of the overall heap size. 3567 .PP 3568 The following examples show how to set the initial size of the young 3569 generation to 256 MB using various units: 3570 .IP 3571 .nf 3572 \f[CB] 3573 \-XX:NewSize=256m 3574 \-XX:NewSize=262144k 3575 \-XX:NewSize=268435456 3576 \f[R] 3577 .fi 3578 .PP 3579 The \f[CB]\-XX:NewSize\f[R] option is equivalent to \f[CB]\-Xmn\f[R]. 3580 .RE 3581 .TP 3582 .B \f[CB]\-XX:ParallelGCThreads=\f[R]\f[I]threads\f[R] 3583 Sets the number of the stop\-the\-world (STW) worker threads. 3584 The default value depends on the number of CPUs available to the JVM and 3585 the garbage collector selected. 3586 .RS 3587 .PP 3588 For example, to set the number of threads for G1 GC to 2, specify the 3589 following option: 3590 .RS 3591 .PP 3592 \f[CB]\-XX:ParallelGCThreads=2\f[R] 3593 .RE 3594 .RE 3595 .TP 3596 .B \f[CB]\-XX:+ParallelRefProcEnabled\f[R] 3597 Enables parallel reference processing. 3598 By default, this option is disabled. 3599 .RS 3600 .RE 3601 .TP 3602 .B \f[CB]\-XX:+PrintAdaptiveSizePolicy\f[R] 3603 Enables printing of information about adaptive\-generation sizing. 3604 By default, this option is disabled. 3605 .RS 3606 .RE 3607 .TP 3608 .B \f[CB]\-XX:+ScavengeBeforeFullGC\f[R] 3609 Enables GC of the young generation before each full GC. 3610 This option is enabled by default. 3611 It is recommended that you \f[I]don\[aq]t\f[R] disable it, because 3612 scavenging the young generation before a full GC can reduce the number 3613 of objects reachable from the old generation space into the young 3614 generation space. 3615 To disable GC of the young generation before each full GC, specify the 3616 option \f[CB]\-XX:\-ScavengeBeforeFullGC\f[R]. 3617 .RS 3618 .RE 3619 .TP 3620 .B \f[CB]\-XX:SoftRefLRUPolicyMSPerMB=\f[R]\f[I]time\f[R] 3621 Sets the amount of time (in milliseconds) a softly reachable object is 3622 kept active on the heap after the last time it was referenced. 3623 The default value is one second of lifetime per free megabyte in the 3624 heap. 3625 The \f[CB]\-XX:SoftRefLRUPolicyMSPerMB\f[R] option accepts integer values 3626 representing milliseconds per one megabyte of the current heap size (for 3627 Java HotSpot Client VM) or the maximum possible heap size (for Java 3628 HotSpot Server VM). 3629 This difference means that the Client VM tends to flush soft references 3630 rather than grow the heap, whereas the Server VM tends to grow the heap 3631 rather than flush soft references. 3632 In the latter case, the value of the \f[CB]\-Xmx\f[R] option has a 3633 significant effect on how quickly soft references are garbage collected. 3634 .RS 3635 .PP 3636 The following example shows how to set the value to 2.5 seconds: 3637 .PP 3638 \f[CB]\-XX:SoftRefLRUPolicyMSPerMB=2500\f[R] 3639 .RE 3640 .TP 3641 .B \f[CB]\-XX:\-ShrinkHeapInSteps\f[R] 3642 Incrementally reduces the Java heap to the target size, specified by the 3643 option \f[CB]\-XX:MaxHeapFreeRatio\f[R]. 3644 This option is enabled by default. 3645 If disabled, then it immediately reduces the Java heap to the target 3646 size instead of requiring multiple garbage collection cycles. 3647 Disable this option if you want to minimize the Java heap size. 3648 You will likely encounter performance degradation when this option is 3649 disabled. 3650 .RS 3651 .PP 3652 See \f[B]Performance Tuning Examples\f[R] for a description of using the 3653 \f[CB]MaxHeapFreeRatio\f[R] option to keep the Java heap small by reducing 3654 the dynamic footprint for embedded applications. 3655 .RE 3656 .TP 3657 .B \f[CB]\-XX:StringDeduplicationAgeThreshold=\f[R]\f[I]threshold\f[R] 3658 Identifies \f[CB]String\f[R] objects reaching the specified age that are 3659 considered candidates for deduplication. 3660 An object\[aq]s age is a measure of how many times it has survived 3661 garbage collection. 3662 This is sometimes referred to as tenuring. 3663 .RS 3664 .RS 3665 .PP 3666 \f[B]Note:\f[R] \f[CB]String\f[R] objects that are promoted to an old heap 3667 region before this age has been reached are always considered candidates 3668 for deduplication. 3669 The default value for this option is \f[CB]3\f[R]. 3670 See the \f[CB]\-XX:+UseStringDeduplication\f[R] option. 3671 .RE 3672 .RE 3673 .TP 3674 .B \f[CB]\-XX:SurvivorRatio=\f[R]\f[I]ratio\f[R] 3675 Sets the ratio between eden space size and survivor space size. 3676 By default, this option is set to 8. 3677 The following example shows how to set the eden/survivor space ratio to 3678 4: 3679 .RS 3680 .RS 3681 .PP 3682 \f[CB]\-XX:SurvivorRatio=4\f[R] 3683 .RE 3684 .RE 3685 .TP 3686 .B \f[CB]\-XX:TargetSurvivorRatio=\f[R]\f[I]percent\f[R] 3687 Sets the desired percentage of survivor space (0 to 100) used after 3688 young garbage collection. 3689 By default, this option is set to 50%. 3690 .RS 3691 .PP 3692 The following example shows how to set the target survivor space ratio 3693 to 30%: 3694 .RS 3695 .PP 3696 \f[CB]\-XX:TargetSurvivorRatio=30\f[R] 3697 .RE 3698 .RE 3699 .TP 3700 .B \f[CB]\-XX:TLABSize=\f[R]\f[I]size\f[R] 3701 Sets the initial size (in bytes) of a thread\-local allocation buffer 3702 (TLAB). 3703 Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes, 3704 \f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or 3705 \f[CB]G\f[R] to indicate gigabytes. 3706 If this option is set to 0, then the JVM selects the initial size 3707 automatically. 3708 .RS 3709 .PP 3710 The following example shows how to set the initial TLAB size to 512 KB: 3711 .RS 3712 .PP 3713 \f[CB]\-XX:TLABSize=512k\f[R] 3714 .RE 3715 .RE 3716 .TP 3717 .B \f[CB]\-XX:+UseAdaptiveSizePolicy\f[R] 3718 Enables the use of adaptive generation sizing. 3719 This option is enabled by default. 3720 To disable adaptive generation sizing, specify 3721 \f[CB]\-XX:\-UseAdaptiveSizePolicy\f[R] and set the size of the memory 3722 allocation pool explicitly. 3723 See the \f[CB]\-XX:SurvivorRatio\f[R] option. 3724 .RS 3725 .RE 3726 .TP 3727 .B \f[CB]\-XX:+UseCMSInitiatingOccupancyOnly\f[R] 3728 Enables the use of the occupancy value as the only criterion for 3729 initiating the CMS collector. 3730 By default, this option is disabled and other criteria may be used. 3731 .RS 3732 .RE 3733 .TP 3734 .B \f[CB]\-XX:+UseG1GC\f[R] 3735 Enables the use of the garbage\-first (G1) garbage collector. 3736 It\[aq]s a server\-style garbage collector, targeted for multiprocessor 3737 machines with a large amount of RAM. 3738 This option meets GC pause time goals with high probability, while 3739 maintaining good throughput. 3740 The G1 collector is recommended for applications requiring large heaps 3741 (sizes of around 6 GB or larger) with limited GC latency requirements (a 3742 stable and predictable pause time below 0.5 seconds). 3743 By default, this option is enabled and G1 is used as the default garbage 3744 collector. 3745 .RS 3746 .RE 3747 .TP 3748 .B \f[CB]\-XX:+UseGCOverheadLimit\f[R] 3749 Enables the use of a policy that limits the proportion of time spent by 3750 the JVM on GC before an \f[CB]OutOfMemoryError\f[R] exception is thrown. 3751 This option is enabled, by default, and the parallel GC will throw an 3752 \f[CB]OutOfMemoryError\f[R] if more than 98% of the total time is spent on 3753 garbage collection and less than 2% of the heap is recovered. 3754 When the heap is small, this feature can be used to prevent applications 3755 from running for long periods of time with little or no progress. 3756 To disable this option, specify the option 3757 \f[CB]\-XX:\-UseGCOverheadLimit\f[R]. 3758 .RS 3759 .RE 3760 .TP 3761 .B \f[CB]\-XX:+UseNUMA\f[R] 3762 Enables performance optimization of an application on a machine with 3763 nonuniform memory architecture (NUMA) by increasing the 3764 application\[aq]s use of lower latency memory. 3765 By default, this option is disabled and no optimization for NUMA is 3766 made. 3767 The option is available only when the parallel garbage collector is used 3768 (\f[CB]\-XX:+UseParallelGC\f[R]). 3769 .RS 3770 .RE 3771 .TP 3772 .B \f[CB]\-XX:+UseParallelGC\f[R] 3773 Enables the use of the parallel scavenge garbage collector (also known 3774 as the throughput collector) to improve the performance of your 3775 application by leveraging multiple processors. 3776 .RS 3777 .PP 3778 By default, this option is disabled and the default collector is used. 3779 If it\[aq]s enabled, then the \f[CB]\-XX:+UseParallelOldGC\f[R] option is 3780 automatically enabled, unless you explicitly disable it. 3781 .RE 3782 .TP 3783 .B \f[CB]\-XX:+UseParallelOldGC\f[R] 3784 Enables the use of the parallel garbage collector for full GCs. 3785 By default, this option is disabled. 3786 Enabling it automatically enables the \f[CB]\-XX:+UseParallelGC\f[R] 3787 option. 3788 .RS 3789 .RE 3790 .TP 3791 .B \f[CB]\-XX:+UseSerialGC\f[R] 3792 Enables the use of the serial garbage collector. 3793 This is generally the best choice for small and simple applications that 3794 don\[aq]t require any special functionality from garbage collection. 3795 By default, this option is disabled and the default collector is used. 3796 .RS 3797 .RE 3798 .TP 3799 .B \f[CB]\-XX:+UseSHM\f[R] 3800 \f[B]Linux only:\f[R] Enables the JVM to use shared memory to set up 3801 large pages. 3802 .RS 3803 .PP 3804 See \f[B]Large Pages\f[R] for setting up large pages. 3805 .RE 3806 .TP 3807 .B \f[CB]\-XX:+UseStringDeduplication\f[R] 3808 Enables string deduplication. 3809 By default, this option is disabled. 3810 To use this option, you must enable the garbage\-first (G1) garbage 3811 collector. 3812 .RS 3813 .PP 3814 String deduplication reduces the memory footprint of \f[CB]String\f[R] 3815 objects on the Java heap by taking advantage of the fact that many 3816 \f[CB]String\f[R] objects are identical. 3817 Instead of each \f[CB]String\f[R] object pointing to its own character 3818 array, identical \f[CB]String\f[R] objects can point to and share the same 3819 character array. 3820 .RE 3821 .TP 3822 .B \f[CB]\-XX:+UseTLAB\f[R] 3823 Enables the use of thread\-local allocation blocks (TLABs) in the young 3824 generation space. 3825 This option is enabled by default. 3826 To disable the use of TLABs, specify the option \f[CB]\-XX:\-UseTLAB\f[R]. 3827 .RS 3828 .RE 3829 .TP 3830 .B \f[CB]\-XX:+UseZGC\f[R] 3831 Enables the use of the Z garbage collector. 3832 This garbage collector is best for providing lowest latency with large 3833 Java heaps at some throughput cost. 3834 This is an experimental garbage collector, you need to specify 3835 \f[CB]\-XX:+UnlockExperimentalVMOptions\f[R] before \f[CB]\-XX:+UseZGC\f[R] 3836 on the command line. 3837 .RS 3838 .PP 3839 Example: 3840 .RS 3841 .PP 3842 \f[CB]\-XX:+UnlockExperimentalVMOptions\ \-XX:+UseZGC\f[R] 3843 .RE 3844 .RE 3845 .SH DEPRECATED JAVA OPTIONS 3846 .PP 3847 These \f[CB]java\f[R] options are deprecated and might be removed in a 3848 future JDK release. 3849 They\[aq]re still accepted and acted upon, but a warning is issued when 3850 they\[aq]re used. 3851 .TP 3852 .B \f[CB]\-Xfuture\f[R] 3853 Enables strict class\-file format checks that enforce close conformance 3854 to the class\-file format specification. 3855 Developers should use this flag when developing new code. 3856 Stricter checks may become the default in future releases. 3857 .RS 3858 .RE 3859 .TP 3860 .B \f[CB]\-Xloggc:\f[R]\f[I]filename\f[R] 3861 Sets the file to which verbose GC events information should be 3862 redirected for logging. 3863 The \f[CB]\-Xloggc\f[R] option overrides \f[CB]\-verbose:gc\f[R] if both are 3864 given with the same java command. 3865 \f[CB]\-Xloggc:\f[R]\f[I]filename\f[R] is replaced by 3866 \f[CB]\-Xlog:gc:\f[R]\f[I]filename\f[R]. 3867 See Enable Logging with the JVM Unified Logging Framework. 3868 .RS 3869 .PP 3870 Example: 3871 .PP 3872 \f[CB]\-Xlog:gc:garbage\-collection.log\f[R] 3873 .RE 3874 .TP 3875 .B \f[CB]\-XX:+FailOverToOldVerifier\f[R] 3876 Enables automatic failover to the old verifier when the new type checker 3877 fails. 3878 By default, this option is disabled and it\[aq]s ignored (that is, 3879 treated as disabled) for classes with a recent bytecode version. 3880 You can enable it only for classes with older versions of the bytecode. 3881 .RS 3882 .RE 3883 .TP 3884 .B \f[CB]\-XX:+FlightRecorder\f[R] 3885 Enables the use of Java Flight Recorder (JFR) during the runtime of the 3886 application. 3887 Since JDK 8u40 this option has not been required to use JFR. 3888 .RS 3889 .RE 3890 .TP 3891 .B \f[CB]\-XX:InitialRAMFraction=\f[R]\f[I]ratio\f[R] 3892 Sets the initial amount of memory that the JVM may use for the Java heap 3893 before applying ergonomics heuristics as a ratio of the maximum amount 3894 determined as described in the \f[CB]\-XX:MaxRAM\f[R] option. 3895 The default value is 64. 3896 .RS 3897 .PP 3898 Use the option \f[CB]\-XX:InitialRAMPercentage\f[R] instead. 3899 .RE 3900 .TP 3901 .B \f[CB]\-XX:MaxRAMFraction=\f[R]\f[I]ratio\f[R] 3902 Sets the maximum amount of memory that the JVM may use for the Java heap 3903 before applying ergonomics heuristics as a fraction of the maximum 3904 amount determined as described in the \f[CB]\-XX:MaxRAM\f[R] option. 3905 The default value is 4. 3906 .RS 3907 .PP 3908 Specifying this option disables automatic use of compressed oops if the 3909 combined result of this and other options influencing the maximum amount 3910 of memory is larger than the range of memory addressable by compressed 3911 oops. 3912 See \f[CB]\-XX:UseCompressedOops\f[R] for further information about 3913 compressed oops. 3914 .PP 3915 Use the option \f[CB]\-XX:MaxRAMPercentage\f[R] instead. 3916 .RE 3917 .TP 3918 .B \f[CB]\-XX:MinRAMFraction=\f[R]\f[I]ratio\f[R] 3919 Sets the maximum amount of memory that the JVM may use for the Java heap 3920 before applying ergonomics heuristics as a fraction of the maximum 3921 amount determined as described in the \f[CB]\-XX:MaxRAM\f[R] option for 3922 small heaps. 3923 A small heap is a heap of approximately 125 MB. 3924 The default value is 2. 3925 .RS 3926 .PP 3927 Use the option \f[CB]\-XX:MinRAMPercentage\f[R] instead. 3928 .RE 3929 .TP 3930 .B \f[CB]\-XX:+TraceClassLoading\f[R] 3931 Enables tracing of classes as they are loaded. 3932 By default, this option is disabled and classes aren\[aq]t traced. 3933 .RS 3934 .PP 3935 The replacement Unified Logging syntax is 3936 \f[CB]\-Xlog:class+load=\f[R]\f[I]level\f[R]. 3937 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R] 3938 .PP 3939 Use \f[I]level\f[R]=\f[CB]info\f[R] for regular information, or 3940 \f[I]level\f[R]=\f[CB]debug\f[R] for additional information. 3941 In Unified Logging syntax, \f[CB]\-verbose:class\f[R] equals 3942 \f[CB]\-Xlog:class+load=info,class+unload=info\f[R]. 3943 .RE 3944 .TP 3945 .B \f[CB]\-XX:+TraceClassLoadingPreorder\f[R] 3946 Enables tracing of all loaded classes in the order in which they\[aq]re 3947 referenced. 3948 By default, this option is disabled and classes aren\[aq]t traced. 3949 .RS 3950 .PP 3951 The replacement Unified Logging syntax is 3952 \f[CB]\-Xlog:class+preorder=debug\f[R]. 3953 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R]. 3954 .RE 3955 .TP 3956 .B \f[CB]\-XX:+TraceClassResolution\f[R] 3957 Enables tracing of constant pool resolutions. 3958 By default, this option is disabled and constant pool resolutions 3959 aren\[aq]t traced. 3960 .RS 3961 .PP 3962 The replacement Unified Logging syntax is 3963 \f[CB]\-Xlog:class+resolve=debug\f[R]. 3964 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R]. 3965 .RE 3966 .TP 3967 .B \f[CB]\-XX:+TraceLoaderConstraints\f[R] 3968 Enables tracing of the loader constraints recording. 3969 By default, this option is disabled and loader constraints recording 3970 isn\[aq]t traced. 3971 .RS 3972 .PP 3973 The replacement Unified Logging syntax is 3974 \f[CB]\-Xlog:class+loader+constraints=info\f[R]. 3975 See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R]. 3976 .RE 3977 .TP 3978 .B \f[CB]\-XX:+UseConcMarkSweepGC\f[R] 3979 Enables the use of the CMS garbage collector for the old generation. 3980 CMS is an alternative to the default garbage collector (G1), which also 3981 focuses on meeting application latency requirements. 3982 By default, this option is disabled and the collector is selected 3983 automatically based on the configuration of the machine and type of the 3984 JVM. 3985 The CMS garbage collector is deprecated. 3986 .RS 3987 .RE 3988 .SH OBSOLETE JAVA OPTIONS 3989 .PP 3990 These \f[CB]java\f[R] options are still accepted but ignored, and a 3991 warning is issued when they\[aq]re used. 3992 .TP 3993 .B \f[CB]\-XX:+UseMembar\f[R] 3994 Enabled issuing membars on thread\-state transitions. 3995 This option was disabled by default on all platforms except ARM servers, 3996 where it was enabled. 3997 .RS 3998 .RE 3999 .TP 4000 .B \f[CB]\-XX:MaxPermSize=\f[R]\f[I]size\f[R] 4001 Sets the maximum permanent generation space size (in bytes). 4002 This option was deprecated in JDK 8 and superseded by the 4003 \f[CB]\-XX:MaxMetaspaceSize\f[R] option. 4004 .RS 4005 .RE 4006 .TP 4007 .B \f[CB]\-XX:PermSize=\f[R]\f[I]size\f[R] 4008 Sets the space (in bytes) allocated to the permanent generation that 4009 triggers a garbage collection if it\[aq]s exceeded. 4010 This option was deprecated in JDK 8 and superseded by the 4011 \f[CB]\-XX:MetaspaceSize\f[R] option. 4012 .RS 4013 .RE 4014 .SH REMOVED JAVA OPTIONS 4015 .PP 4016 These \f[CB]java\f[R] options have been removed in JDK 13 and using them 4017 results in an error of: 4018 .RS 4019 .PP 4020 \f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R] 4021 .RE 4022 .TP 4023 .B \f[CB]\-XX:+AggressiveOpts\f[R] 4024 Enabled the use of aggressive performance optimization features. 4025 By default, this option was disabled and experimental performance 4026 features were not used. 4027 .RS 4028 .RE 4029 .PP 4030 For the lists and descriptions of options removed in previous releases 4031 see the \f[I]Removed Java Options\f[R] section in: 4032 .IP \[bu] 2 4033 \f[B]Java Platform, Standard Edition Tools Reference, Release 12\f[R] 4034 [https://docs.oracle.com/en/java/javase/12/tools/java.html#GUID\-3B1CE181\-CD30\-4178\-9602\-230B800D4FAE] 4035 .IP \[bu] 2 4036 \f[B]Java Platform, Standard Edition Tools Reference, Release 11\f[R] 4037 [https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID\-741FC470\-AA3E\-494A\-8D2B\-1B1FE4A990D1] 4038 .IP \[bu] 2 4039 \f[B]Java Platform, Standard Edition Tools Reference, Release 10\f[R] 4040 [https://docs.oracle.com/javase/10/tools/java.htm#JSWOR624] 4041 .IP \[bu] 2 4042 \f[B]Java Platform, Standard Edition Tools Reference, Release 9\f[R] 4043 [https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624] 4044 .IP \[bu] 2 4045 \f[B]Java Platform, Standard Edition Tools Reference, Release 8 for 4046 Oracle JDK on Windows\f[R] 4047 [https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BGBCIEFC] 4048 .IP \[bu] 2 4049 \f[B]Java Platform, Standard Edition Tools Reference, Release 8 for 4050 Oracle JDK on Solaris, Linux, and macOS\f[R] 4051 [https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#BGBCIEFC] 4052 .SH JAVA COMMAND\-LINE ARGUMENT FILES 4053 .PP 4054 You can shorten or simplify the \f[CB]java\f[R] command by using 4055 \f[CB]\@\f[R] argument files to specify one or more text files that 4056 contain arguments, such as options and class names, which are passed to 4057 the \f[CB]java\f[R] command. 4058 This let\[aq]s you to create \f[CB]java\f[R] commands of any length on any 4059 operating system. 4060 .PP 4061 In the command line, use the at sign (\f[CB]\@\f[R]) prefix to identify an 4062 argument file that contains \f[CB]java\f[R] options and class names. 4063 When the \f[CB]java\f[R] command encounters a file beginning with the at 4064 sign (\f[CB]\@\f[R]), it expands the contents of that file into an 4065 argument list just as they would be specified on the command line. 4066 .PP 4067 The \f[CB]java\f[R] launcher expands the argument file contents until it 4068 encounters the \f[CB]\-\-disable\-\@files\f[R] option. 4069 You can use the \f[CB]\-\-disable\-\@files\f[R] option anywhere on the 4070 command line, including in an argument file, to stop \f[CB]\@\f[R] 4071 argument files expansion. 4072 .PP 4073 The following items describe the syntax of \f[CB]java\f[R] argument files: 4074 .IP \[bu] 2 4075 The argument file must contain only ASCII characters or characters in 4076 system default encoding that\[aq]s ASCII friendly, such as UTF\-8. 4077 .IP \[bu] 2 4078 The argument file size must not exceed MAXINT (2,147,483,647) bytes. 4079 .IP \[bu] 2 4080 The launcher doesn\[aq]t expand wildcards that are present within an 4081 argument file. 4082 .IP \[bu] 2 4083 Use white space or new line characters to separate arguments included in 4084 the file. 4085 .IP \[bu] 2 4086 White space includes a white space character, \f[CB]\\t\f[R], 4087 \f[CB]\\n\f[R], \f[CB]\\r\f[R], and \f[CB]\\f\f[R]. 4088 .RS 2 4089 .PP 4090 For example, it is possible to have a path with a space, such as 4091 \f[CB]c:\\Program\ Files\f[R] that can be specified as either 4092 \f[CB]"c:\\\\Program\ Files"\f[R] or, to avoid an escape, 4093 \f[CB]c:\\Program"\ "Files\f[R]. 4094 .RE 4095 .IP \[bu] 2 4096 Any option that contains spaces, such as a path component, must be 4097 within quotation marks using quotation (\[aq]"\[aq]) characters in its 4098 entirety. 4099 .IP \[bu] 2 4100 A string within quotation marks may contain the characters \f[CB]\\n\f[R], 4101 \f[CB]\\r\f[R], \f[CB]\\t\f[R], and \f[CB]\\f\f[R]. 4102 They are converted to their respective ASCII codes. 4103 \ 4104 .IP \[bu] 2 4105 If a file name contains embedded spaces, then put the whole file name in 4106 double quotation marks. 4107 .IP \[bu] 2 4108 File names in an argument file are relative to the current directory, 4109 not to the location of the argument file. 4110 .IP \[bu] 2 4111 Use the number sign \f[CB]#\f[R] in the argument file to identify 4112 comments. 4113 All characters following the \f[CB]#\f[R] are ignored until the end of 4114 line. 4115 .IP \[bu] 2 4116 Additional at sign \f[CB]\@\f[R] prefixes to \f[CB]\@\f[R] prefixed options 4117 act as an escape, (the first \f[CB]\@\f[R] is removed and the rest of the 4118 arguments are presented to the launcher literally). 4119 .IP \[bu] 2 4120 Lines may be continued using the continuation character (\f[CB]\\\f[R]) at 4121 the end\-of\-line. 4122 The two lines are concatenated with the leading white spaces trimmed. 4123 To prevent trimming the \ leading white spaces, a continuation character 4124 (\f[CB]\\\f[R]) may be placed at the first column. 4125 .IP \[bu] 2 4126 Because backslash (\\) is an escape character, a backslash 4127 character\ must be escaped with another backslash character. 4128 .IP \[bu] 2 4129 Partial quote is allowed and is closed by an end\-of\-file. 4130 .IP \[bu] 2 4131 An open quote stops at end\-of\-line unless \f[CB]\\\f[R] is the last 4132 character, which then joins the next line by removing all leading white 4133 space characters. 4134 .IP \[bu] 2 4135 Wildcards (*) aren\[aq]t allowed in these lists (such as specifying 4136 \f[CB]*.java\f[R]). 4137 .IP \[bu] 2 4138 Use of the at sign (\f[CB]\@\f[R]) to recursively interpret files 4139 isn\[aq]t supported. 4140 .SS Example of Open or Partial Quotes in an Argument File 4141 .PP 4142 In the argument file, 4143 .IP 4144 .nf 4145 \f[CB] 4146 \-cp\ "lib/ 4147 cool/ 4148 app/ 4149 jars 4150 \f[R] 4151 .fi 4152 .PP 4153 this is interpreted as: 4154 .RS 4155 .PP 4156 \f[CB]\-cp\ lib/cool/app/jars\f[R] 4157 .RE 4158 .SS Example of a Backslash Character\ Escaped with Another Backslash 4159 Character in an Argument File 4160 .PP 4161 To output the following: 4162 .RS 4163 .PP 4164 \f[CB]\-cp\ c:\\Program\ Files\ (x86)\\Java\\jre\\lib\\ext;c:\\Program\ Files\\Java\\jre9\\lib\\ext\f[R] 4165 .RE 4166 .PP 4167 The backslash character must be specified in the argument file as: 4168 .RS 4169 .PP 4170 \f[CB]\-cp\ \ "c:\\\\Program\ Files\ (x86)\\\\Java\\\\jre\\\\lib\\\\ext;c:\\\\Program\ Files\\\\Java\\\\jre9\\\\lib\\\\ext"\f[R] 4171 .RE 4172 .SS Example of an EOL Escape Used to Force Concatenation of Lines in an 4173 Argument File 4174 .PP 4175 In the argument file, 4176 .IP 4177 .nf 4178 \f[CB] 4179 \-cp\ "/lib/cool\ app/jars:\\ 4180 \ \ \ \ /lib/another\ app/jars" 4181 \f[R] 4182 .fi 4183 .PP 4184 This is interpreted as: 4185 .RS 4186 .PP 4187 \f[CB]\-cp\ /lib/cool\ app/jars:/lib/another\ app/jars\f[R] 4188 .RE 4189 .SS Example of Line Continuation with Leading Spaces in an Argument File 4190 .PP 4191 In the argument file, 4192 .IP 4193 .nf 4194 \f[CB] 4195 \-cp\ "/lib/cool\\ 4196 \\app/jars” 4197 \f[R] 4198 .fi 4199 .PP 4200 This is interpreted as: 4201 .PP 4202 \f[CB]\-cp\ /lib/cool\ app/jars\f[R] 4203 .SS Examples of Using Single Argument File 4204 .PP 4205 You can use a single argument file, such as \f[CB]myargumentfile\f[R] in 4206 the following example, to hold all required \f[CB]java\f[R] arguments: 4207 .RS 4208 .PP 4209 \f[CB]java\ \@myargumentfile\f[R] 4210 .RE 4211 .SS Examples of Using Argument Files with Paths 4212 .PP 4213 You can include relative paths in argument files; however, they\[aq]re 4214 relative to the current working directory and not to the paths of the 4215 argument files themselves. 4216 In the following example, \f[CB]path1/options\f[R] and 4217 \f[CB]path2/options\f[R] represent argument files with different paths. 4218 Any relative paths that they contain are relative to the current working 4219 directory and not to the argument files: 4220 .RS 4221 .PP 4222 \f[CB]java\ \@path1/options\ \@path2/classes\f[R] 4223 .RE 4224 .SH CODE HEAP STATE ANALYTICS 4225 .SS Overview 4226 .PP 4227 There are occasions when having insight into the current state of the 4228 JVM code heap would be helpful to answer questions such as: 4229 .IP \[bu] 2 4230 Why was the JIT turned off and then on again and again? 4231 .IP \[bu] 2 4232 Where has all the code heap space gone? 4233 .IP \[bu] 2 4234 Why is the method sweeper not working effectively? 4235 .PP 4236 To provide this insight, a code heap state analytics feature has been 4237 implemented that enables on\-the\-fly analysis of the code heap. 4238 The analytics process is divided into two parts. 4239 The first part examines the entire code heap and aggregates all 4240 information that is believed to be useful or important. 4241 The second part consists of several independent steps that print the 4242 collected information with an emphasis on different aspects of the data. 4243 Data collection and printing are done on an "on request" basis. 4244 .SS Syntax 4245 .PP 4246 Requests for real\-time, on\-the\-fly analysis can be issued with the 4247 following command: 4248 .RS 4249 .PP 4250 \f[CB]jcmd\f[R] \f[I]pid\f[R] \f[CB]Compiler.CodeHeap_Analytics\f[R] 4251 [\f[I]function\f[R]] [\f[I]granularity\f[R]] 4252 .RE 4253 .PP 4254 If you are only interested in how the code heap looks like after running 4255 a sample workload, you can use the command line option: 4256 .RS 4257 .PP 4258 \f[CB]\-Xlog:codecache=Trace\f[R] 4259 .RE 4260 .PP 4261 To see the code heap state when a "CodeCache full" condition exists, 4262 start the VM with the command line option: 4263 .RS 4264 .PP 4265 \f[CB]\-Xlog:codecache=Debug\f[R] 4266 .RE 4267 .PP 4268 See \f[B]CodeHeap State Analytics (OpenJDK)\f[R] 4269 [https://bugs.openjdk.java.net/secure/attachment/75649/JVM_CodeHeap_StateAnalytics_V2.pdf] 4270 for a detailed description of the code heap state analytics feature, the 4271 supported functions, and the granularity options. 4272 .SH ENABLE LOGGING WITH THE JVM UNIFIED LOGGING FRAMEWORK 4273 .PP 4274 You use the \f[CB]\-Xlog\f[R] option to configure or enable logging with 4275 the Java Virtual Machine (JVM) unified logging framework. 4276 .SS Synopsis 4277 .RS 4278 .PP 4279 \f[CB]\-Xlog\f[R][\f[CB]:\f[R][\f[I]what\f[R]][\f[CB]:\f[R][\f[I]output\f[R]][\f[CB]:\f[R][\f[I]decorators\f[R]][\f[CB]:\f[R]\f[I]output\-options\f[R][\f[CB],\f[R]...]]]]] 4280 .RE 4281 .TP 4282 .B \f[I]what\f[R] 4283 Specifies a combination of tags and levels of the form 4284 \f[I]tag1\f[R][\f[CB]+\f[R]\f[I]tag2\f[R]...][\f[CB]*\f[R]][\f[CB]=\f[R]\f[I]level\f[R]][\f[CB],\f[R]...]. 4285 Unless the wildcard (\f[CB]*\f[R]) is specified, only log messages tagged 4286 with exactly the tags specified are matched. 4287 See \f[B]\-Xlog Tags and Levels\f[R]. 4288 .RS 4289 .RE 4290 .TP 4291 .B \f[I]output\f[R] 4292 Sets the type of output. 4293 Omitting the \f[I]output\f[R] type defaults to \f[CB]stdout\f[R]. 4294 See \f[B]\-Xlog Output\f[R]. 4295 .RS 4296 .RE 4297 .TP 4298 .B \f[I]decorators\f[R] 4299 Configures the output to use a custom set of decorators. 4300 Omitting \f[I]decorators\f[R] defaults to \f[CB]uptime\f[R], 4301 \f[CB]level\f[R], and \f[CB]tags\f[R]. 4302 See \f[B]Decorations\f[R]. 4303 .RS 4304 .RE 4305 .TP 4306 .B \f[I]output\-options\f[R] 4307 Sets the \f[CB]\-Xlog\f[R] logging output options. 4308 .RS 4309 .RE 4310 .SS Description 4311 .PP 4312 The Java Virtual Machine (JVM) unified logging framework provides a 4313 common logging system for all components of the JVM. 4314 GC logging for the JVM has been changed to use the new logging 4315 framework. 4316 The mapping of old GC flags to the corresponding new Xlog configuration 4317 is described in \f[B]Convert GC Logging Flags to Xlog\f[R]. 4318 In addition, runtime logging has also been changed to use the JVM 4319 unified logging framework. 4320 The mapping of legacy runtime logging flags to the corresponding new 4321 Xlog configuration is described in \f[B]Convert Runtime Logging Flags to 4322 Xlog\f[R]. 4323 .PP 4324 The following provides quick reference to the \f[CB]\-Xlog\f[R] command 4325 and syntax for options: 4326 .TP 4327 .B \f[CB]\-Xlog\f[R] 4328 Enables JVM logging on an \f[CB]info\f[R] level. 4329 .RS 4330 .RE 4331 .TP 4332 .B \f[CB]\-Xlog:help\f[R] 4333 Prints \f[CB]\-Xlog\f[R] usage syntax and available tags, levels, and 4334 decorators along with example command lines with explanations. 4335 .RS 4336 .RE 4337 .TP 4338 .B \f[CB]\-Xlog:disable\f[R] 4339 Turns off all logging and clears all configuration of the logging 4340 framework including the default configuration for warnings and errors. 4341 .RS 4342 .RE 4343 .TP 4344 .B \f[CB]\-Xlog\f[R][\f[CB]:\f[R]\f[I]option\f[R]] 4345 Applies multiple arguments in the order that they appear on the command 4346 line. 4347 Multiple \f[CB]\-Xlog\f[R] arguments for the same output override each 4348 other in their given order. 4349 .RS 4350 .PP 4351 The \f[I]option\f[R] is set as: 4352 .RS 4353 .PP 4354 [\f[I]tag\-selection\f[R]][\f[CB]:\f[R][\f[I]output\f[R]][\f[CB]:\f[R][\f[I]decorators\f[R]][\f[CB]:\f[R]\f[I]output\-options\f[R]]]] 4355 .RE 4356 .PP 4357 Omitting the \f[I]tag\-selection\f[R] defaults to a tag\-set of 4358 \f[CB]all\f[R] and a level of \f[CB]info\f[R]. 4359 .RS 4360 .PP 4361 \f[I]tag\f[R][\f[CB]+\f[R]...] \f[CB]all\f[R] 4362 .RE 4363 .PP 4364 The \f[CB]all\f[R] tag is a meta tag consisting of all tag\-sets 4365 available. 4366 The asterisk \f[CB]*\f[R] in a tag set definition denotes a wildcard tag 4367 match. 4368 Matching with a wildcard selects all tag sets that contain \f[I]at 4369 least\f[R] the specified tags. 4370 Without the wildcard, only exact matches of the specified tag sets are 4371 selected. 4372 .PP 4373 \f[I]output\-options\f[R] is 4374 .RS 4375 .PP 4376 \f[CB]filecount=\f[R]\f[I]file\-count\f[R] \f[CB]filesize=\f[R]\f[I]file size 4377 with optional K, M or G suffix\f[R] 4378 .RE 4379 .RE 4380 .SS Default Configuration 4381 .PP 4382 When the \f[CB]\-Xlog\f[R] option and nothing else is specified on the 4383 command line, the default configuration is used. 4384 The default configuration logs all messages with a level that matches 4385 either warning or error regardless of what tags the message is 4386 associated with. 4387 The default configuration is equivalent to entering the following on the 4388 command line: 4389 .RS 4390 .PP 4391 \f[CB]\-Xlog:all=warning:stdout:uptime,level,tags\f[R] 4392 .RE 4393 .SS Controlling Logging at Runtime 4394 .PP 4395 Logging can also be controlled at run time through Diagnostic Commands 4396 (with the \f[B]jcmd\f[R] utility). 4397 Everything that can be specified on the command line can also be 4398 specified dynamically with the \f[CB]VM.log\f[R] command. 4399 As the diagnostic commands are automatically exposed as MBeans, you can 4400 use JMX to change logging configuration at run time. 4401 .SS \-Xlog Tags and Levels 4402 .PP 4403 Each log message has a level and a tag set associated with it. 4404 The level of the message corresponds to its details, and the tag set 4405 corresponds to what the message contains or which JVM component it 4406 involves (such as, \f[CB]gc\f[R], \f[CB]jit\f[R], or \f[CB]os\f[R]). 4407 Mapping GC flags to the Xlog configuration is described in \f[B]Convert 4408 GC Logging Flags to Xlog\f[R]. 4409 Mapping legacy runtime logging flags to the corresponding Xlog 4410 configuration is described in \f[B]Convert Runtime Logging Flags to 4411 Xlog\f[R]. 4412 .PP 4413 \f[B]Available log levels:\f[R] 4414 .IP \[bu] 2 4415 \f[CB]off\f[R] 4416 .IP \[bu] 2 4417 \f[CB]trace\f[R] 4418 .IP \[bu] 2 4419 \f[CB]debug\f[R] 4420 .IP \[bu] 2 4421 \f[CB]info\f[R] 4422 .IP \[bu] 2 4423 \f[CB]warning\f[R] 4424 .IP \[bu] 2 4425 \f[CB]error\f[R] 4426 .PP 4427 \f[B]Available log tags:\f[R] 4428 .PP 4429 There are literally dozens of log tags, which in the right combinations, 4430 will enable a range of logging output. 4431 The full set of available log tags can be seen using 4432 \f[CB]\-Xlog:help\f[R]. 4433 Specifying \f[CB]all\f[R] instead of a tag combination matches all tag 4434 combinations. 4435 .SS \-Xlog Output 4436 .PP 4437 The \f[CB]\-Xlog\f[R] option supports the following types of outputs: 4438 .IP \[bu] 2 4439 \f[CB]stdout\f[R] \-\-\- Sends output to stdout 4440 .IP \[bu] 2 4441 \f[CB]stderr\f[R] \-\-\- Sends output to stderr 4442 .IP \[bu] 2 4443 \f[CB]file=\f[R]\f[I]filename\f[R] \-\-\- Sends output to text file(s). 4444 .PP 4445 When using \f[CB]file=\f[R]\f[I]filename\f[R], specifying \f[CB]%p\f[R] 4446 and/or \f[CB]%t\f[R] in the file name expands to the JVM\[aq]s PID and 4447 startup timestamp, respectively. 4448 You can also configure text files to handle file rotation based on file 4449 size and a number of files to rotate. 4450 For example, to rotate the log file every 10 MB and keep 5 files in 4451 rotation, specify the options \f[CB]filesize=10M,\ filecount=5\f[R]. 4452 The target size of the files isn\[aq]t guaranteed to be exact, it\[aq]s 4453 just an approximate value. 4454 Files are rotated by default with up to 5 rotated files of target size 4455 20 MB, unless configured otherwise. 4456 Specifying \f[CB]filecount=0\f[R] means that the log file shouldn\[aq]t be 4457 rotated. 4458 There\[aq]s a possibility of the pre\-existing log file getting 4459 overwritten. 4460 .SS Decorations 4461 .PP 4462 Logging messages are decorated with information about the message. 4463 You can configure each output to use a custom set of decorators. 4464 The order of the output is always the same as listed in the table. 4465 You can configure the decorations to be used at run time. 4466 Decorations are prepended to the log message. 4467 For example: 4468 .IP 4469 .nf 4470 \f[CB] 4471 [6.567s][info][gc,old]\ Old\ collection\ complete 4472 \f[R] 4473 .fi 4474 .PP 4475 Omitting \f[CB]decorators\f[R] defaults to \f[CB]uptime\f[R], 4476 \f[CB]level\f[R], and \f[CB]tags\f[R]. 4477 The \f[CB]none\f[R] decorator is special and is used to turn off all 4478 decorations. 4479 .PP 4480 \f[CB]time\f[R] (\f[CB]t\f[R]), \f[CB]utctime\f[R] (\f[CB]utc\f[R]), 4481 \f[CB]uptime\f[R] (\f[CB]u\f[R]), \f[CB]timemillis\f[R] (\f[CB]tm\f[R]), 4482 \f[CB]uptimemillis\f[R] (\f[CB]um\f[R]), \f[CB]timenanos\f[R] (\f[CB]tn\f[R]), 4483 \f[CB]uptimenanos\f[R] (\f[CB]un\f[R]), \f[CB]hostname\f[R] (\f[CB]hn\f[R]), 4484 \f[CB]pid\f[R] (\f[CB]p\f[R]), \f[CB]tid\f[R] (\f[CB]ti\f[R]), \f[CB]level\f[R] 4485 (\f[CB]l\f[R]), \f[CB]tags\f[R] (\f[CB]tg\f[R]) decorators can also be 4486 specified as \f[CB]none\f[R] for no decoration. 4487 .PP 4488 .TS 4489 tab(@); 4490 lw(14.9n) lw(55.1n). 4491 T{ 4492 Decorations 4493 T}@T{ 4494 Description 4495 T} 4496 _ 4497 T{ 4498 \f[CB]time\f[R] or \f[CB]t\f[R] 4499 T}@T{ 4500 Current time and date in ISO\-8601 format. 4501 T} 4502 T{ 4503 \f[CB]utctime\f[R] or \f[CB]utc\f[R] 4504 T}@T{ 4505 Universal Time Coordinated or Coordinated Universal Time. 4506 T} 4507 T{ 4508 \f[CB]uptime\f[R] or \f[CB]u\f[R] 4509 T}@T{ 4510 Time since the start of the JVM in seconds and milliseconds. 4511 For example, 6.567s. 4512 T} 4513 T{ 4514 \f[CB]timemillis\f[R] or \f[CB]tm\f[R] 4515 T}@T{ 4516 The same value as generated by \f[CB]System.currentTimeMillis()\f[R] 4517 T} 4518 T{ 4519 \f[CB]uptimemillis\f[R] or \f[CB]um\f[R] 4520 T}@T{ 4521 Milliseconds since the JVM started. 4522 T} 4523 T{ 4524 \f[CB]timenanos\f[R] or \f[CB]tn\f[R] 4525 T}@T{ 4526 The same value generated by \f[CB]System.nanoTime()\f[R]. 4527 T} 4528 T{ 4529 \f[CB]uptimenanos\f[R] or \f[CB]un\f[R] 4530 T}@T{ 4531 Nanoseconds since the JVM started. 4532 T} 4533 T{ 4534 \f[CB]hostname\f[R] or \f[CB]hn\f[R] 4535 T}@T{ 4536 The host name. 4537 T} 4538 T{ 4539 \f[CB]pid\f[R] or \f[CB]p\f[R] 4540 T}@T{ 4541 The process identifier. 4542 T} 4543 T{ 4544 \f[CB]tid\f[R] or \f[CB]ti\f[R] 4545 T}@T{ 4546 The thread identifier. 4547 T} 4548 T{ 4549 \f[CB]level\f[R] or \f[CB]l\f[R] 4550 T}@T{ 4551 The level associated with the log message. 4552 T} 4553 T{ 4554 \f[CB]tags\f[R] or \f[CB]tg\f[R] 4555 T}@T{ 4556 The tag\-set associated with the log message. 4557 T} 4558 .TE 4559 .SS Convert GC Logging Flags to Xlog 4560 .PP 4561 .TS 4562 tab(@); 4563 lw(22.4n) lw(16.5n) lw(31.2n). 4564 T{ 4565 Legacy Garbage Collection (GC) Flag 4566 T}@T{ 4567 Xlog Configuration 4568 T}@T{ 4569 Comment 4570 T} 4571 _ 4572 T{ 4573 \f[CB]G1PrintHeapRegions\f[R] 4574 T}@T{ 4575 \f[CB]\-Xlog:gc+region=trace\f[R] 4576 T}@T{ 4577 Not Applicable 4578 T} 4579 T{ 4580 \f[CB]GCLogFileSize\f[R] 4581 T}@T{ 4582 No configuration available 4583 T}@T{ 4584 Log rotation is handled by the framework. 4585 T} 4586 T{ 4587 \f[CB]NumberOfGCLogFiles\f[R] 4588 T}@T{ 4589 Not Applicable 4590 T}@T{ 4591 Log rotation is handled by the framework. 4592 T} 4593 T{ 4594 \f[CB]PrintAdaptiveSizePolicy\f[R] 4595 T}@T{ 4596 \f[CB]\-Xlog:gc+ergo*=\f[R]\f[I]level\f[R] 4597 T}@T{ 4598 Use a \f[I]level\f[R] of \f[CB]debug\f[R] for most of the information, or a 4599 \f[I]level\f[R] of \f[CB]trace\f[R] for all of what was logged for 4600 \f[CB]PrintAdaptiveSizePolicy\f[R]. 4601 T} 4602 T{ 4603 \f[CB]PrintGC\f[R] 4604 T}@T{ 4605 \f[CB]\-Xlog:gc\f[R] 4606 T}@T{ 4607 Not Applicable 4608 T} 4609 T{ 4610 \f[CB]PrintGCApplicationConcurrentTime\f[R] 4611 T}@T{ 4612 \f[CB]\-Xlog:safepoint\f[R] 4613 T}@T{ 4614 Note that \f[CB]PrintGCApplicationConcurrentTime\f[R] and 4615 \f[CB]PrintGCApplicationStoppedTime\f[R] are logged on the same tag and 4616 aren\[aq]t separated in the new logging. 4617 T} 4618 T{ 4619 \f[CB]PrintGCApplicationStoppedTime\f[R] 4620 T}@T{ 4621 \f[CB]\-Xlog:safepoint\f[R] 4622 T}@T{ 4623 Note that \f[CB]PrintGCApplicationConcurrentTime\f[R] and 4624 \f[CB]PrintGCApplicationStoppedTime\f[R] are logged on the same tag and 4625 not separated in the new logging. 4626 T} 4627 T{ 4628 \f[CB]PrintGCCause\f[R] 4629 T}@T{ 4630 Not Applicable 4631 T}@T{ 4632 GC cause is now always logged. 4633 T} 4634 T{ 4635 \f[CB]PrintGCDateStamps\f[R] 4636 T}@T{ 4637 Not Applicable 4638 T}@T{ 4639 Date stamps are logged by the framework. 4640 T} 4641 T{ 4642 \f[CB]PrintGCDetails\f[R] 4643 T}@T{ 4644 \f[CB]\-Xlog:gc*\f[R] 4645 T}@T{ 4646 Not Applicable 4647 T} 4648 T{ 4649 \f[CB]PrintGCID\f[R] 4650 T}@T{ 4651 Not Applicable 4652 T}@T{ 4653 GC ID is now always logged. 4654 T} 4655 T{ 4656 \f[CB]PrintGCTaskTimeStamps\f[R] 4657 T}@T{ 4658 \f[CB]\-Xlog:gc+task*=debug\f[R] 4659 T}@T{ 4660 Not Applicable 4661 T} 4662 T{ 4663 \f[CB]PrintGCTimeStamps\f[R] 4664 T}@T{ 4665 Not Applicable 4666 T}@T{ 4667 Time stamps are logged by the framework. 4668 T} 4669 T{ 4670 \f[CB]PrintHeapAtGC\f[R] 4671 T}@T{ 4672 \f[CB]\-Xlog:gc+heap=trace\f[R] 4673 T}@T{ 4674 Not Applicable 4675 T} 4676 T{ 4677 \f[CB]PrintReferenceGC\f[R] 4678 T}@T{ 4679 \f[CB]\-Xlog:gc+ref*=debug\f[R] 4680 T}@T{ 4681 Note that in the old logging, \f[CB]PrintReferenceGC\f[R] had an effect 4682 only if \f[CB]PrintGCDetails\f[R] was also enabled. 4683 T} 4684 T{ 4685 \f[CB]PrintStringDeduplicationStatistics\f[R] 4686 T}@T{ 4687 `\-Xlog:gc+stringdedup*=debug 4688 T}@T{ 4689 ` Not Applicable 4690 T} 4691 T{ 4692 \f[CB]PrintTenuringDistribution\f[R] 4693 T}@T{ 4694 \f[CB]\-Xlog:gc+age*=\f[R]\f[I]level\f[R] 4695 T}@T{ 4696 Use a \f[I]level\f[R] of \f[CB]debug\f[R] for the most relevant 4697 information, or a \f[I]level\f[R] of \f[CB]trace\f[R] for all of what was 4698 logged for \f[CB]PrintTenuringDistribution\f[R]. 4699 T} 4700 T{ 4701 \f[CB]UseGCLogFileRotation\f[R] 4702 T}@T{ 4703 Not Applicable 4704 T}@T{ 4705 What was logged for \f[CB]PrintTenuringDistribution\f[R]. 4706 T} 4707 .TE 4708 .SS Convert Runtime Logging Flags to Xlog 4709 .PP 4710 .TS 4711 tab(@); 4712 lw(15.0n) lw(20.2n) lw(34.7n). 4713 T{ 4714 Legacy Runtime Flag 4715 T}@T{ 4716 Xlog Configuration 4717 T}@T{ 4718 Comment 4719 T} 4720 _ 4721 T{ 4722 \f[CB]TraceExceptions\f[R] 4723 T}@T{ 4724 \f[CB]\-Xlog:exceptions=info\f[R] 4725 T}@T{ 4726 Not Applicable 4727 T} 4728 T{ 4729 \f[CB]TraceClassLoading\f[R] 4730 T}@T{ 4731 \f[CB]\-Xlog:class+load=\f[R]\f[I]level\f[R] 4732 T}@T{ 4733 Use \f[I]level\f[R]=\f[CB]info\f[R] for regular information, or 4734 \f[I]level\f[R]=\f[CB]debug\f[R] for additional information. 4735 In Unified Logging syntax, \f[CB]\-verbose:class\f[R] equals 4736 \f[CB]\-Xlog:class+load=info,class+unload=info\f[R]. 4737 T} 4738 T{ 4739 \f[CB]TraceClassLoadingPreorder\f[R] 4740 T}@T{ 4741 \f[CB]\-Xlog:class+preorder=debug\f[R] 4742 T}@T{ 4743 Not Applicable 4744 T} 4745 T{ 4746 \f[CB]TraceClassUnloading\f[R] 4747 T}@T{ 4748 \f[CB]\-Xlog:class+unload=\f[R]\f[I]level\f[R] 4749 T}@T{ 4750 Use \f[I]level\f[R]=\f[CB]info\f[R] for regular information, or 4751 \f[I]level\f[R]=\f[CB]trace\f[R] for additional information. 4752 In Unified Logging syntax, \f[CB]\-verbose:class\f[R] equals 4753 \f[CB]\-Xlog:class+load=info,class+unload=info\f[R]. 4754 T} 4755 T{ 4756 \f[CB]VerboseVerification\f[R] 4757 T}@T{ 4758 \f[CB]\-Xlog:verification=info\f[R] 4759 T}@T{ 4760 Not Applicable 4761 T} 4762 T{ 4763 \f[CB]TraceClassPaths\f[R] 4764 T}@T{ 4765 \f[CB]\-Xlog:class+path=info\f[R] 4766 T}@T{ 4767 Not Applicable 4768 T} 4769 T{ 4770 \f[CB]TraceClassResolution\f[R] 4771 T}@T{ 4772 \f[CB]\-Xlog:class+resolve=debug\f[R] 4773 T}@T{ 4774 Not Applicable 4775 T} 4776 T{ 4777 \f[CB]TraceClassInitialization\f[R] 4778 T}@T{ 4779 \f[CB]\-Xlog:class+init=info\f[R] 4780 T}@T{ 4781 Not Applicable 4782 T} 4783 T{ 4784 \f[CB]TraceLoaderConstraints\f[R] 4785 T}@T{ 4786 \f[CB]\-Xlog:class+loader+constraints=info\f[R] 4787 T}@T{ 4788 Not Applicable 4789 T} 4790 T{ 4791 \f[CB]TraceClassLoaderData\f[R] 4792 T}@T{ 4793 \f[CB]\-Xlog:class+loader+data=\f[R]\f[I]level\f[R] 4794 T}@T{ 4795 Use \f[I]level\f[R]=\f[CB]debug\f[R] for regular information or 4796 \f[I]level\f[R]=\f[CB]trace\f[R] for additional information. 4797 T} 4798 T{ 4799 \f[CB]TraceSafepointCleanupTime\f[R] 4800 T}@T{ 4801 \f[CB]\-Xlog:safepoint+cleanup=info\f[R] 4802 T}@T{ 4803 Not Applicable 4804 T} 4805 T{ 4806 \f[CB]TraceSafepoint\f[R] 4807 T}@T{ 4808 \f[CB]\-Xlog:safepoint=debug\f[R] 4809 T}@T{ 4810 Not Applicable 4811 T} 4812 T{ 4813 \f[CB]TraceMonitorInflation\f[R] 4814 T}@T{ 4815 \f[CB]\-Xlog:monitorinflation=debug\f[R] 4816 T}@T{ 4817 Not Applicable 4818 T} 4819 T{ 4820 \f[CB]TraceBiasedLocking\f[R] 4821 T}@T{ 4822 \f[CB]\-Xlog:biasedlocking=\f[R]\f[I]level\f[R] 4823 T}@T{ 4824 Use \f[I]level\f[R]=\f[CB]info\f[R] for regular information, or 4825 \f[I]level\f[R]=\f[CB]trace\f[R] for additional information. 4826 T} 4827 T{ 4828 \f[CB]TraceRedefineClasses\f[R] 4829 T}@T{ 4830 \f[CB]\-Xlog:redefine+class*=\f[R]\f[I]level\f[R] 4831 T}@T{ 4832 \f[I]level\f[R]=\f[CB]info\f[R], \f[CB]debug\f[R], and \f[CB]trace\f[R] provide 4833 increasing amounts of information. 4834 T} 4835 .TE 4836 .SS \-Xlog Usage Examples 4837 .PP 4838 The following are \f[CB]\-Xlog\f[R] examples. 4839 .TP 4840 .B \f[CB]\-Xlog\f[R] 4841 Logs all messages by using the \f[CB]info\f[R] level to \f[CB]stdout\f[R] 4842 with \f[CB]uptime\f[R], \f[CB]levels\f[R], and \f[CB]tags\f[R] decorations. 4843 This is equivalent to using: 4844 .RS 4845 .RS 4846 .PP 4847 \f[CB]\-Xlog:all=info:stdout:uptime,levels,tags\f[R] 4848 .RE 4849 .RE 4850 .TP 4851 .B \f[CB]\-Xlog:gc\f[R] 4852 Logs messages tagged with the \f[CB]gc\f[R] tag using \f[CB]info\f[R] level 4853 to \f[CB]stdout\f[R]. 4854 The default configuration for all other messages at level 4855 \f[CB]warning\f[R] is in effect. 4856 .RS 4857 .RE 4858 .TP 4859 .B \f[CB]\-Xlog:gc,safepoint\f[R] 4860 Logs messages tagged either with the \f[CB]gc\f[R] or \f[CB]safepoint\f[R] 4861 tags, both using the \f[CB]info\f[R] level, to \f[CB]stdout\f[R], with 4862 default decorations. 4863 Messages tagged with both \f[CB]gc\f[R] and \f[CB]safepoint\f[R] won\[aq]t 4864 be logged. 4865 .RS 4866 .RE 4867 .TP 4868 .B \f[CB]\-Xlog:gc+ref=debug\f[R] 4869 Logs messages tagged with both \f[CB]gc\f[R] and \f[CB]ref\f[R] tags, using 4870 the \f[CB]debug\f[R] level to \f[CB]stdout\f[R], with default decorations. 4871 Messages tagged only with one of the two tags won\[aq]t be logged. 4872 .RS 4873 .RE 4874 .TP 4875 .B \f[CB]\-Xlog:gc=debug:file=gc.txt:none\f[R] 4876 Logs messages tagged with the \f[CB]gc\f[R] tag using the \f[CB]debug\f[R] 4877 level to a file called \f[CB]gc.txt\f[R] with no decorations. 4878 The default configuration for all other messages at level 4879 \f[CB]warning\f[R] is still in effect. 4880 .RS 4881 .RE 4882 .TP 4883 .B \f[CB]\-Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024\f[R] 4884 Logs messages tagged with the \f[CB]gc\f[R] tag using the \f[CB]trace\f[R] 4885 level to a rotating file set with 5 files with size 1 MB with the base 4886 name \f[CB]gctrace.txt\f[R] and uses decorations \f[CB]uptimemillis\f[R] and 4887 \f[CB]pid\f[R]. 4888 .RS 4889 .PP 4890 The default configuration for all other messages at level 4891 \f[CB]warning\f[R] is still in effect. 4892 .RE 4893 .TP 4894 .B \f[CB]\-Xlog:gc::uptime,tid\f[R] 4895 Logs messages tagged with the \f[CB]gc\f[R] tag using the default 4896 \[aq]info\[aq] level to default the output \f[CB]stdout\f[R] and uses 4897 decorations \f[CB]uptime\f[R] and \f[CB]tid\f[R]. 4898 The default configuration for all other messages at level 4899 \f[CB]warning\f[R] is still in effect. 4900 .RS 4901 .RE 4902 .TP 4903 .B \f[CB]\-Xlog:gc*=info,safepoint*=off\f[R] 4904 Logs messages tagged with at least \f[CB]gc\f[R] using the \f[CB]info\f[R] 4905 level, but turns off logging of messages tagged with \f[CB]safepoint\f[R]. 4906 Messages tagged with both \f[CB]gc\f[R] and \f[CB]safepoint\f[R] won\[aq]t 4907 be logged. 4908 .RS 4909 .RE 4910 .TP 4911 .B \f[CB]\-Xlog:disable\ \-Xlog:safepoint=trace:safepointtrace.txt\f[R] 4912 Turns off all logging, including warnings and errors, and then enables 4913 messages tagged with \f[CB]safepoint\f[R]using \f[CB]trace\f[R]level to the 4914 file \f[CB]safepointtrace.txt\f[R]. 4915 The default configuration doesn\[aq]t apply, because the command line 4916 started with \f[CB]\-Xlog:disable\f[R]. 4917 .RS 4918 .RE 4919 .SS Complex \-Xlog Usage Examples 4920 .PP 4921 The following describes a few complex examples of using the 4922 \f[CB]\-Xlog\f[R] option. 4923 .TP 4924 .B \f[CB]\-Xlog:gc+class*=debug\f[R] 4925 Logs messages tagged with at least \f[CB]gc\f[R] and \f[CB]class\f[R] tags 4926 using the \f[CB]debug\f[R] level to \f[CB]stdout\f[R]. 4927 The default configuration for all other messages at the level 4928 \f[CB]warning\f[R] is still in effect 4929 .RS 4930 .RE 4931 .TP 4932 .B \f[CB]\-Xlog:gc+meta*=trace,class*=off:file=gcmetatrace.txt\f[R] 4933 Logs messages tagged with at least the \f[CB]gc\f[R] and \f[CB]meta\f[R] 4934 tags using the \f[CB]trace\f[R] level to the file \f[CB]metatrace.txt\f[R] 4935 but turns off all messages tagged with \f[CB]class\f[R]. 4936 Messages tagged with \f[CB]gc\f[R], \f[CB]meta\f[R], and \f[CB]class\f[R] 4937 aren\[aq]t be logged as \f[CB]class*\f[R] is set to off. 4938 The default configuration for all other messages at level 4939 \f[CB]warning\f[R] is in effect except for those that include 4940 \f[CB]class\f[R]. 4941 .RS 4942 .RE 4943 .TP 4944 .B \f[CB]\-Xlog:gc+meta=trace\f[R] 4945 Logs messages tagged with exactly the \f[CB]gc\f[R] and \f[CB]meta\f[R] tags 4946 using the \f[CB]trace\f[R] level to \f[CB]stdout\f[R]. 4947 The default configuration for all other messages at level 4948 \f[CB]warning\f[R] is still be in effect. 4949 .RS 4950 .RE 4951 .TP 4952 .B \f[CB]\-Xlog:gc+class+heap*=debug,meta*=warning,threads*=off\f[R] 4953 Logs messages tagged with at least \f[CB]gc\f[R], \f[CB]class\f[R], and 4954 \f[CB]heap\f[R] tags using the \f[CB]trace\f[R] level to \f[CB]stdout\f[R] but 4955 only log messages tagged with \f[CB]meta\f[R] with level. 4956 The default configuration for all other messages at the level 4957 \f[CB]warning\f[R] is in effect except for those that include 4958 \f[CB]threads\f[R]. 4959 .RS 4960 .RE 4961 .SH VALIDATE JAVA VIRTUAL MACHINE FLAG ARGUMENTS 4962 .PP 4963 You use values provided to all Java Virtual Machine (JVM) command\-line 4964 flags for validation and, if the input value is invalid or 4965 out\-of\-range, then an appropriate error message is displayed. 4966 .PP 4967 Whether they\[aq]re set ergonomically, in a command line, by an input 4968 tool, or through the APIs (for example, classes contained in the package 4969 \f[CB]java.lang.management\f[R]) the values provided to all Java Virtual 4970 Machine (JVM) command\-line flags are validated. 4971 Ergonomics are described in Java Platform, Standard Edition HotSpot 4972 Virtual Machine Garbage Collection Tuning Guide. 4973 .PP 4974 Range and constraints are validated either when all flags have their 4975 values set during JVM initialization or a flag\[aq]s value is changed 4976 during runtime (for example using the \f[CB]jcmd\f[R] tool). 4977 The JVM is terminated if a value violates either the range or constraint 4978 check and an appropriate error message is printed on the error stream. 4979 .PP 4980 For example, if a flag violates a range or a constraint check, then the 4981 JVM exits with an error: 4982 .IP 4983 .nf 4984 \f[CB] 4985 java\ \-XX:AllocatePrefetchStyle=5\ \-version\ \ \ 4986 intx\ AllocatePrefetchStyle=5\ is\ outside\ the\ allowed\ range\ [\ 0\ ...\ 3\ ]\ \ \ 4987 Improperly\ specified\ VM\ option\ \[aq]AllocatePrefetchStyle=5\[aq]\ \ \ 4988 Error:\ Could\ not\ create\ the\ Java\ Virtual\ Machine.\ \ 4989 Error:\ A\ fatal\ exception\ has\ occurred.\ Program\ will\ exit. 4990 \f[R] 4991 .fi 4992 .PP 4993 The flag \f[CB]\-XX:+PrintFlagsRanges\f[R] prints the range of all the 4994 flags. 4995 This flag allows automatic testing of the flags by the values provided 4996 by the ranges. 4997 For the flags that have the ranges specified, the type, name, and the 4998 actual range is printed in the output. 4999 .PP 5000 For example, 5001 .IP 5002 .nf 5003 \f[CB] 5004 intx\ \ \ ThreadStackSize\ [\ 0\ ...\ 9007199254740987\ ]\ {pd\ product} 5005 \f[R] 5006 .fi 5007 .PP 5008 For the flags that don\[aq]t have the range specified, the values 5009 aren\[aq]t displayed in the print out. 5010 For example: 5011 .IP 5012 .nf 5013 \f[CB] 5014 size_t\ NewSize\ \ \ \ \ \ \ \ \ [\ \ \ ...\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ]\ {product} 5015 \f[R] 5016 .fi 5017 .PP 5018 This helps to identify the flags that need to be implemented. 5019 The automatic testing framework can skip those flags that don\[aq]t have 5020 values and aren\[aq]t implemented. 5021 .SH LARGE PAGES 5022 .PP 5023 You use large pages, also known as huge pages, as memory pages that are 5024 significantly larger than the standard memory page size (which varies 5025 depending on the processor and operating system). 5026 Large pages optimize processor Translation\-Lookaside Buffers. 5027 .PP 5028 A Translation\-Lookaside Buffer (TLB) is a page translation cache that 5029 holds the most\-recently used virtual\-to\-physical address 5030 translations. 5031 A TLB is a scarce system resource. 5032 A TLB miss can be costly because the processor must then read from the 5033 hierarchical page table, which may require multiple memory accesses. 5034 By using a larger memory page size, a single TLB entry can represent a 5035 larger memory range. 5036 This results in less pressure on a TLB, and memory\-intensive 5037 applications may have better performance. 5038 .PP 5039 However, large pages page memory can negatively affect system 5040 performance. 5041 For example, when a large mount of memory is pinned by an application, 5042 it may create a shortage of regular memory and cause excessive paging in 5043 other applications and slow down the entire system. 5044 Also, a system that has been up for a long time could produce excessive 5045 fragmentation, which could make it impossible to reserve enough large 5046 page memory. 5047 When this happens, either the OS or JVM reverts to using regular pages. 5048 .PP 5049 Oracle Solaris, Linux, and Windows support large pages. 5050 .SS Large Pages Support for Oracle Solaris 5051 .PP 5052 Oracle Solaris includes Multiple Page Size Support (MPSS). 5053 No additional configuration is necessary. 5054 .SS Large Pages Support for Linux 5055 .PP 5056 The 2.6 kernel supports large pages. 5057 Some vendors have backported the code to their 2.4\-based releases. 5058 To check if your system can support large page memory, try the 5059 following: 5060 .IP 5061 .nf 5062 \f[CB] 5063 #\ cat\ /proc/meminfo\ |\ grep\ Huge 5064 HugePages_Total:\ 0 5065 HugePages_Free:\ 0 5066 Hugepagesize:\ 2048\ kB 5067 \f[R] 5068 .fi 5069 .PP 5070 If the output shows the three "Huge" variables, then your system can 5071 support large page memory but it needs to be configured. 5072 If the command prints nothing, then your system doesn\[aq]t support 5073 large pages. 5074 To configure the system to use large page memory, login as 5075 \f[CB]root\f[R], and then follow these steps: 5076 .IP "1." 3 5077 If you\[aq]re using the option \f[CB]\-XX:+UseSHM\f[R] (instead of 5078 \f[CB]\-XX:+UseHugeTLBFS\f[R]), then increase the \f[CB]SHMMAX\f[R] value. 5079 It must be larger than the Java heap size. 5080 On a system with 4 GB of physical RAM (or less), the following makes all 5081 the memory sharable: 5082 .RS 4 5083 .RS 5084 .PP 5085 \f[CB]#\ echo\ 4294967295\ >\ /proc/sys/kernel/shmmax\f[R] 5086 .RE 5087 .RE 5088 .IP "2." 3 5089 If you\[aq]re using the option \f[CB]\-XX:+UseSHM\f[R] or 5090 \f[CB]\-XX:+UseHugeTLBFS\f[R], then specify the number of large pages. 5091 In the following example, 3 GB of a 4 GB system are reserved for large 5092 pages (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB = 5093 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048 kB = 1536): 5094 .RS 4 5095 .RS 5096 .PP 5097 \f[CB]#\ echo\ 1536\ >\ /proc/sys/vm/nr_hugepages\f[R] 5098 .RE 5099 .RS 5100 .PP 5101 \f[B]Note:\f[R] The values contained in \f[CB]/proc\f[R] resets after you 5102 reboot your system, so may want to set them in an initialization script 5103 (for example, \f[CB]rc.local\f[R] or \f[CB]sysctl.conf\f[R]). 5104 .RE 5105 .RE 5106 .IP \[bu] 2 5107 If you configure (or resize) the OS kernel parameters 5108 \f[CB]/proc/sys/kernel/shmmax\f[R] or \f[CB]/proc/sys/vm/nr_hugepages\f[R], 5109 Java processes may allocate large pages for areas in addition to the 5110 Java heap. 5111 These steps can allocate large pages for the following areas: 5112 .RS 2 5113 .IP \[bu] 2 5114 Java heap 5115 .IP \[bu] 2 5116 Code cache 5117 .IP \[bu] 2 5118 The marking bitmap data structure for the parallel GC 5119 .PP 5120 Consequently, if you configure the \f[CB]nr_hugepages\f[R] parameter to 5121 the size of the Java heap, then the JVM can fail in allocating the code 5122 cache areas on large pages because these areas are quite large in size. 5123 .RE 5124 .SS Large Pages Support for Windows 5125 .PP 5126 To use large pages support on Windows, the administrator must first 5127 assign additional privileges to the user who is running the application: 5128 .IP "1." 3 5129 Select \f[B]Control Panel\f[R], \f[B]Administrative Tools\f[R], and then 5130 \f[B]Local Security Policy\f[R]. 5131 .IP "2." 3 5132 Select \f[B]Local Policies\f[R] and then \f[B]User Rights Assignment\f[R]. 5133 .IP "3." 3 5134 Double\-click \f[B]Lock pages in memory\f[R], then add users and/or 5135 groups. 5136 .IP "4." 3 5137 Reboot your system. 5138 .PP 5139 Note that these steps are required even if it\[aq]s the administrator 5140 who\[aq]s running the application, because administrators by default 5141 don\[aq]t have the privilege to lock pages in memory. 5142 .SH APPLICATION CLASS DATA SHARING 5143 .PP 5144 Application Class Data Sharing (AppCDS) extends class data sharing (CDS) 5145 to enable application classes to be placed in a shared archive. 5146 .PP 5147 In addition to the core library classes, AppCDS supports \f[B]Class Data 5148 Sharing\f[R] 5149 [https://docs.oracle.com/en/java/javase/12/vm/class\-data\-sharing.html#GUID\-7EAA3411\-8CF0\-4D19\-BD05\-DF5E1780AA91] 5150 from the following locations: 5151 .IP \[bu] 2 5152 Platform classes from the runtime image 5153 .IP \[bu] 2 5154 Application classes from the runtime image 5155 .IP \[bu] 2 5156 Application classes from the class path 5157 .IP \[bu] 2 5158 Application classes from the module path 5159 .PP 5160 Archiving application classes provides better start up time at runtime. 5161 When running multiple JVM processes, AppCDS also reduces the runtime 5162 footprint with memory sharing for read\-only metadata. 5163 .PP 5164 CDS/AppCDS supports archiving classes from JAR files only. 5165 .PP 5166 Prior to JDK 11, a non\-empty directory was reported as a fatal error in 5167 the following conditions: 5168 .IP \[bu] 2 5169 For base CDS, a non\-empty directory cannot exist in the 5170 \f[CB]\-Xbootclasspath/a\f[R] path 5171 .IP \[bu] 2 5172 With \f[CB]\-XX:+UseAppCDS\f[R], a non\-empty directory could not exist in 5173 the \f[CB]\-Xbootclasspath/a\f[R] path, class path, and module path. 5174 .PP 5175 In JDK 11 and later, \f[CB]\-XX:+UseAppCDS\f[R] is obsolete and the 5176 behavior for a non\-empty directory is based on the class types in the 5177 classlist. 5178 A non\-empty directory is reported as a fatal error in the following 5179 conditions: 5180 .IP \[bu] 2 5181 If application classes or platform classes are not loaded, dump time 5182 only reports an error if a non\-empty directory exists in 5183 \f[CB]\-Xbootclasspath/a\f[R] path 5184 .IP \[bu] 2 5185 If application classes or platform classes are loaded, dump time reports 5186 an error for a non\-empty directory that exists in 5187 \f[CB]\-Xbootclasspath/a\f[R] path, class path, or module path 5188 .PP 5189 In JDK 11 and later, using 5190 \f[CB]\-XX:DumpLoadedClassList=\f[R]\f[I]class_list_file\f[R] results a 5191 generated classlist with all classes (both system library classes and 5192 application classes) included. 5193 You no longer have to specify \f[CB]\-XX:+UseAppCDS\f[R] with 5194 \f[CB]\-XX:DumpLoadedClassList\f[R] to produce a complete class list. 5195 .PP 5196 In JDK 11 and later, because \f[CB]UseAppCDS\f[R] is obsolete, 5197 \f[CB]SharedArchiveFile\f[R] becomes a product flag by default. 5198 Specifying \f[CB]+UnlockDiagnosticVMOptions\f[R] for 5199 \f[CB]SharedArchiveFile\f[R] is no longer needed in any configuration. 5200 .PP 5201 Class Data Sharing (CDS)/AppCDS does not support archiving array classes 5202 in a class list. 5203 When an array in the class list is encountered, CDS dump time gives the 5204 explicit error message: 5205 .RS 5206 .PP 5207 \f[CB]Preload\ Warning:\ Cannot\ find\f[R] \f[I]array_name\f[R] 5208 .RE 5209 .PP 5210 Although an array in the class list is not allowed, some array classes 5211 can still be created at CDS/AppCDS dump time. 5212 Those arrays are created during the execution of the Java code used by 5213 the Java class loaders (\f[CB]PlatformClassLoader\f[R] and the system 5214 class loader) to load classes at dump time. 5215 The created arrays are archived with the rest of the loaded classes. 5216 .SS Extending Class Data Sharing to Support the Module Path 5217 .PP 5218 In JDK 11, Class Data Sharing (CDS) has been improved to support 5219 archiving classes from the module path. 5220 .IP \[bu] 2 5221 To create a CDS archive using the \f[CB]\-\-module\-path\f[R] VM option, 5222 use the following command line syntax: 5223 .RS 2 5224 .RS 5225 .PP 5226 \f[CB]java\ \-Xshare:dump\ \-XX:SharedClassListFile=\f[R]\f[I]class_list_file\f[R] 5227 \f[CB]\-XX:SharedArchiveFile=\f[R]\f[I]shared_archive_file\f[R] 5228 \f[CB]\-\-module\-path=\f[R]\f[I]path_to_modular_jar\f[R] \f[CB]\-m\f[R] 5229 \f[I]module_name\f[R] 5230 .RE 5231 .RE 5232 .IP \[bu] 2 5233 To run with a CDS archive using the \f[CB]\-\-module\-path\f[R] VM option, 5234 use the following the command line syntax: 5235 .RS 2 5236 .RS 5237 .PP 5238 \f[CB]java\ \-XX:SharedArchiveFile=\f[R]\f[I]shared_archive_file\f[R] 5239 \f[CB]\-\-module\-path=\f[R]\f[I]path_to_modular_jar\f[R] \f[CB]\-m\f[R] 5240 \f[I]module_name\f[R] 5241 .RE 5242 .RE 5243 .PP 5244 The following table describes how the VM options related to module paths 5245 can be used along with the \f[CB]\-Xshare\f[R] option. 5246 .PP 5247 .TS 5248 tab(@); 5249 l l l. 5250 T{ 5251 Option 5252 T}@T{ 5253 \-Xshare:dump 5254 T}@T{ 5255 \-Xshare:{on,auto} 5256 T} 5257 _ 5258 T{ 5259 \f[CB]\-\-module\-path\f[R][1] \f[I]mp\f[R] 5260 T}@T{ 5261 Allowed 5262 T}@T{ 5263 Allowed[2] 5264 T} 5265 T{ 5266 \f[CB]\-\-module\f[R] 5267 T}@T{ 5268 Allowed 5269 T}@T{ 5270 Allowed 5271 T} 5272 T{ 5273 \f[CB]\-\-add\-module\f[R] 5274 T}@T{ 5275 Allowed 5276 T}@T{ 5277 Allowed 5278 T} 5279 T{ 5280 \f[CB]\-\-upgrade\-module\-path\f[R][3] 5281 T}@T{ 5282 Disallowed (exits if specified) 5283 T}@T{ 5284 Allowed (disables CDS) 5285 T} 5286 T{ 5287 \f[CB]\-\-patch\-module\f[R][4] 5288 T}@T{ 5289 Disallowed (exits if specified) 5290 T}@T{ 5291 Allowed (disables CDS) 5292 T} 5293 T{ 5294 \f[CB]\-\-limit\-modules\f[R][5] 5295 T}@T{ 5296 Disallowed (exits if specified) 5297 T}@T{ 5298 Allowed (disables CDS) 5299 T} 5300 .TE 5301 .PP 5302 [1] Although there are two ways of specifying a module in a 5303 \f[CB]\-\-module\-path\f[R], that is, modular JAR or exploded module, only 5304 modular JARs are supported. 5305 .PP 5306 [2] Different \f[I]mp\f[R] can be specified during dump time versus run 5307 time. 5308 If an archived class K was loaded from \f[CB]mp1.jar\f[R] at dump time, 5309 but changes in \f[I]mp\f[R] cause it to be available from a different 5310 \f[CB]mp2.jar\f[R] at run time, then the archived version of K will be 5311 disregarded at run time; K will be loaded dynamically. 5312 .PP 5313 [3] Currently, only two system modules are upgradeable 5314 (\f[CB]java.compiler\f[R] and \f[CB]jdk.internal.vm.compiler\f[R]). 5315 However, these modules are seldom upgraded in production software. 5316 .PP 5317 [4] As documented in JEP 261, using \f[CB]\-\-patch\-module\f[R] is 5318 strongly discouraged for production use. 5319 .PP 5320 [5] \f[CB]\-\-limit\-modules\f[R] is intended for testing purposes. 5321 It is seldom used in production software. 5322 .PP 5323 If \f[CB]\-\-upgrade\-module\-path\f[R], \f[CB]\-\-patch\-module\f[R], or 5324 \f[CB]\-\-limit\-modules\f[R] is specified at dump time, an error will be 5325 printed and the JVM will exit. 5326 For example, if the \f[CB]\-\-limit\-modules\f[R] option is specified at 5327 dump time, the user will see the following error: 5328 .IP 5329 .nf 5330 \f[CB] 5331 Error\ occurred\ during\ initialization\ of\ VM 5332 Cannot\ use\ the\ following\ option\ when\ dumping\ the\ shared\ archive:\ \-\-limit\-modules 5333 \f[R] 5334 .fi 5335 .PP 5336 If \f[CB]\-\-upgrade\-module\-path\f[R], \f[CB]\-\-patch\-module\f[R], or 5337 \f[CB]\-\-limit\-modules\f[R] is specified at run time, a warning message 5338 will be printed indicating that CDS is disabled. 5339 For example, if the \f[CB]\-\-limit\-modules\f[R] options is specified at 5340 run time, the user will see the following warning: 5341 .IP 5342 .nf 5343 \f[CB] 5344 Java\ HotSpot(TM)\ 64\-Bit\ Server\ VM\ warning:\ CDS\ is\ disabled\ when\ the\ \-\-limit\-modules\ option\ is\ specified. 5345 \f[R] 5346 .fi 5347 .PP 5348 Several other noteworthy things include: 5349 .IP \[bu] 2 5350 Any valid combinations of \f[CB]\-cp\f[R] and \f[CB]\-\-module\-path\f[R] 5351 are supported. 5352 .IP \[bu] 2 5353 A non\-empty directory in the module path causes a fatal error. 5354 The user will see the following error messages: 5355 .RS 2 5356 .IP 5357 .nf 5358 \f[CB] 5359 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 5360 \f[R] 5361 .fi 5362 .RE 5363 .IP \[bu] 2 5364 Unlike the class path, there\[aq]s no restriction that the module path 5365 at dump time must be equal to or be a prefix of the module path at run 5366 time. 5367 .IP \[bu] 2 5368 The archive is invalidated if an existing JAR in the module path is 5369 updated after archive generation. 5370 .IP \[bu] 2 5371 Removing a JAR from the module path does not invalidate the shared 5372 archive. 5373 Archived classes from the removed JAR are not used at runtime. 5374 .SS Dynamic CDS archive 5375 .PP 5376 Dynamic CDS archive extends AppCDS to allow archiving of classes when a 5377 Java application exits. 5378 It improves the usability of AppCDS by eliminating the trial run step 5379 for creating a class list for each application. 5380 The archived classes include all loaded application classes and library 5381 classes that are not present in the default CDS archive which is 5382 included in the JDK. 5383 .PP 5384 A base archive is required when creating a dynamic archive. 5385 If the base archive is not specified, the default CDS archive is used as 5386 the base archive. 5387 .PP 5388 To create a dynamic CDS archive with the default CDS archive as the base 5389 archive, just add the 5390 \f[CB]\-XX:ArchiveClassesAtExit=<dynamic\ archive>\f[R] option to the 5391 command line for running the Java application. 5392 .PP 5393 If the default CDS archive does not exist, the VM will exit with the 5394 following error: 5395 .IP 5396 .nf 5397 \f[CB] 5398 ArchiveClassesAtExit\ not\ supported\ when\ base\ CDS\ archive\ is\ not\ loaded 5399 \f[R] 5400 .fi 5401 .PP 5402 To run the Java application using a dynamic CDS archive, just add the 5403 \f[CB]\-XX:SharedArchiveFile=<dynamic\ archive>\f[R] option to the command 5404 line for running the Java application. 5405 .PP 5406 The base archive is not required to be specified in the command line. 5407 The base archive information, including its name and full path, will be 5408 retrieved from the dynamic archive header. 5409 Note that the user could also use the \f[CB]\-XX:SharedArchiveFile\f[R] 5410 option for specifying a regular AppCDS archive. 5411 Therefore, the specified archive in the \f[CB]\-XX:SharedArchiveFile\f[R] 5412 option could be either a regular or dynamic archive. 5413 During VM start up the specified archive header will be read. 5414 If \f[CB]\-XX:SharedArchiveFile\f[R] refers to a regular archive, then the 5415 behavior will be unchanged. 5416 If \f[CB]\-XX:SharedArchiveFile\f[R] refers to a dynamic archive, the VM 5417 will retrieve the base archive location from the dynamic archive. 5418 If the dynamic archive was created with the default CDS archive, then 5419 the current default CDS archive will be used, and will be found relative 5420 to the current run time environment. 5421 .PP 5422 Please refer to \f[B]JDK\-8221706\f[R] 5423 [https://bugs.openjdk.java.net/browse/JDK\-8221706] for details on error 5424 checking during dynamic CDS archive dump time and run time. 5425 .SS Creating a Shared Archive File and Using It to Run an Application 5426 .SS AppCDS archive 5427 .PP 5428 The following steps create a shared archive file that contains all the 5429 classes used by the \f[CB]test.Hello\f[R] application. 5430 The last step runs the application with the shared archive file. 5431 .IP "1." 3 5432 Create a list of all classes used by the \f[CB]test.Hello\f[R] 5433 application. 5434 The following command creates a file named \f[CB]hello.classlist\f[R] that 5435 contains a list of all classes used by this application: 5436 .RS 4 5437 .RS 5438 .PP 5439 \f[CB]java\ \-Xshare:off\ \-XX:DumpLoadedClassList=hello.classlist\ \-cp\ hello.jar\ test.Hello\f[R] 5440 .RE 5441 .PP 5442 Note that the classpath specified by the \f[CB]\-cp\f[R] parameter must 5443 contain only JAR files. 5444 .RE 5445 .IP "2." 3 5446 Create a shared archive, named \f[CB]hello.jsa\f[R], that contains all the 5447 classes in \f[CB]hello.classlist\f[R]: 5448 .RS 4 5449 .RS 5450 .PP 5451 \f[CB]java\ \-Xshare:dump\ \-XX:SharedArchiveFile=hello.jsa\ \-XX:SharedClassListFile=hello.classlist\ \-cp\ hello.jar\f[R] 5452 .RE 5453 .PP 5454 Note that the classpath used at archive creation time must be the same 5455 as (or a prefix of) the classpath used at run time. 5456 .RE 5457 .IP "3." 3 5458 Run the application \f[CB]test.Hello\f[R] with the shared archive 5459 \f[CB]hello.jsa\f[R]: 5460 .RS 4 5461 .RS 5462 .PP 5463 \f[CB]java\ \-XX:SharedArchiveFile=hello.jsa\ \-cp\ hello.jar\ test.Hello\f[R] 5464 .RE 5465 .RE 5466 .IP "4." 3 5467 \f[B]Optional\f[R] Verify that the \f[CB]test.Hello\f[R] application is 5468 using the class contained in the \f[CB]hello.jsa\f[R] shared archive: 5469 .RS 4 5470 .RS 5471 .PP 5472 \f[CB]java\ \-XX:SharedArchiveFile=hello.jsa\ \-cp\ hello.jar\ \-verbose:class\ test.Hello\f[R] 5473 .RE 5474 .PP 5475 The output of this command should contain the following text: 5476 .IP 5477 .nf 5478 \f[CB] 5479 Loaded\ test.Hello\ from\ shared\ objects\ file\ by\ sun/misc/Launcher$AppClassLoader 5480 \f[R] 5481 .fi 5482 .RE 5483 .SS Dynamic CDS archive 5484 .PP 5485 The following steps create a dynamic CDS archive file that contains the 5486 classes used by the \f[CB]test.Hello\f[R] application and are not included 5487 in the default CDS archive. 5488 The second step runs the application with the dynamic CDS archive. 5489 .IP "1." 3 5490 Create a dynamic CDS archive, named \f[CB]hello.jsa\f[R], that contains 5491 all the classes in \f[CB]hello.jar\f[R] loaded by the application 5492 \f[CB]test.Hello\f[R]: 5493 .RS 4 5494 .RS 5495 .PP 5496 \f[CB]java\ \-XX:ArchiveClassesAtExit=hello.jsa\ \-cp\ hello.jar\ Hello\f[R] 5497 .RE 5498 .PP 5499 Note that the classpath used at archive creation time must be the same 5500 as (or a prefix of) the classpath used at run time. 5501 .RE 5502 .IP "2." 3 5503 Run the application \f[CB]test.Hello\f[R] with the shared archive 5504 \f[CB]hello.jsa\f[R]: 5505 .RS 4 5506 .RS 5507 .PP 5508 \f[CB]java\ \-XX:SharedArchiveFile=hello.jsa\ \-cp\ hello.jar\ test.Hello\f[R] 5509 .RE 5510 .RE 5511 .IP "3." 3 5512 \f[B]Optional\f[R] Repeat step 4 of the previous section to verify that 5513 the \f[CB]test.Hello\f[R] application is using the class contained in the 5514 \f[CB]hello.jsa\f[R] shared archive. 5515 .PP 5516 To automate the above steps 1 and 2, one can write a script such as the 5517 following: 5518 .IP 5519 .nf 5520 \f[CB] 5521 \ \ \ \ ARCHIVE=hello.jsa 5522 \ \ \ \ if\ test\ \-f\ $ARCHIVE;\ then 5523 \ \ \ \ \ \ \ \ FLAG="\-XX:SharedArchiveFile=$ARCHIVE" 5524 \ \ \ \ else 5525 \ \ \ \ \ \ \ \ FLAG="\-XX:ArchiveClassesAtExit=$ARCHIVE" 5526 \ \ \ \ fi 5527 \ \ \ \ $JAVA_HOME/bin/java\ \-cp\ hello.jar\ $FLAG\ test.Hello 5528 \f[R] 5529 .fi 5530 .PP 5531 Like an AppCDS archive, the archive needs to be re\-generated if the 5532 Java version has changed. 5533 The above script could be adjusted to account for the Java version as 5534 follows: 5535 .IP 5536 .nf 5537 \f[CB] 5538 \ \ \ \ ARCHIVE=hello.jsa 5539 \ \ \ \ VERSION=foo.version 5540 \ \ \ \ if\ test\ \-f\ $ARCHIVE\ \-a\ \-f\ $VERSION\ &&\ cmp\ \-s\ $VERSION\ $JAVA_HOME/release;\ then 5541 \ \ \ \ \ \ \ \ FLAG="\-XX:SharedArchiveFile=$ARCHIVE" 5542 \ \ \ \ else 5543 \ \ \ \ \ \ \ \ FLAG="\-XX:ArchiveClassesAtExit=$ARCHIVE" 5544 \ \ \ \ \ \ \ \ cp\ \-f\ $JAVA_HOME/release\ $VERSION 5545 \ \ \ \ fi 5546 \ \ \ \ $JAVA_HOME/bin/java\ \-cp\ hello.jar\ $FLAG\ test.Hello 5547 \f[R] 5548 .fi 5549 .PP 5550 Currently, we don\[aq]t support concurrent dumping operations to the 5551 same CDS archive. 5552 Care should be taken to avoid multiple writers to the same CDS archive. 5553 .PP 5554 The user could also create a dynamic CDS archive with a specific base 5555 archive, e.g. 5556 named as \f[CB]base.jsa\f[R] as follows: 5557 .RS 5558 .PP 5559 \f[CB]java\ \-XX:SharedArchiveFile=base.jsa\ \-XX:ArchiveClassesAtExit=hello.jsa\ \-cp\ hello.jar\ Hello\f[R] 5560 .RE 5561 .PP 5562 To run the application using the dynamic CDS archive \f[CB]hello.jsa\f[R] 5563 and a specific base CDS archive \f[CB]base.jsa\f[R]: 5564 .RS 5565 .PP 5566 \f[CB]java\ \-XX:SharedArchiveFile=base.jsa:hello.jsa\ \-cp\ hello.jar\ Hello\f[R] 5567 .RE 5568 .PP 5569 Note that on Windows, the above path delimiter \f[CB]:\f[R] should be 5570 replaced with \f[CB];\f[R]. 5571 .PP 5572 The above command for specifying a base archive is useful if the base 5573 archive used for creating the dynamic archive has been moved. 5574 Normally, just specifying the dynamic archive should be sufficient since 5575 the base archive info can be retrieved from the dynamic archive header. 5576 .SS Sharing a Shared Archive Across Multiple Application Processes 5577 .PP 5578 You can share the same archive file across multiple applications 5579 processes. 5580 This reduces memory usage because the archive is memory\-mapped into the 5581 address space of the processes. 5582 The operating system automatically shares the read\-only pages across 5583 these processes. 5584 .PP 5585 The following steps demonstrate how to create a common archive that can 5586 be shared by different applications. 5587 Classes from \f[CB]common.jar\f[R], \f[CB]hello.jar\f[R] and \f[CB]hi.jar\f[R] 5588 are archived in the \f[CB]common.jsa\f[R] because they are all in the 5589 classpath during the archiving step (step 3). 5590 .PP 5591 To include classes from \f[CB]hello.jar\f[R] and \f[CB]hi.jar\f[R], the 5592 \f[CB]\&.jar\f[R] files must be added to the classpath specified by the 5593 \f[CB]\-cp\f[R] parameter. 5594 .IP "1." 3 5595 Create a list of all classes used by the \f[CB]Hello\f[R] application and 5596 another list for the \f[CB]Hi\f[R] application: 5597 .RS 4 5598 .RS 5599 .PP 5600 \f[CB]java\ \-XX:DumpLoadedClassList=hello.classlist\ \-cp\ common.jar:hello.jar\ Hello\f[R] 5601 .RE 5602 .RS 5603 .PP 5604 \f[CB]java\ \-XX:DumpLoadedClassList=hi.classlist\ \-cp\ common.jar:hi.jar\ Hi\f[R] 5605 .RE 5606 .RE 5607 .IP "2." 3 5608 Create a single list of classes used by all the applications that will 5609 share the shared archive file. 5610 .RS 4 5611 .PP 5612 \f[B]Oracle Solaris, Linux, and macOS\f[R] The following commands combine 5613 the files \f[CB]hello.classlist\f[R] and \f[CB]hi.classlist\f[R] into one 5614 file, \f[CB]common.classlist\f[R]: 5615 .RS 5616 .PP 5617 \f[CB]cat\ hello.classlist\ hi.classlist\ >\ common.classlist\f[R] 5618 .RE 5619 .PP 5620 \f[B]Windows\f[R] The following commands combine the files 5621 \f[CB]hello.classlist\f[R] and \f[CB]hi.classlist\f[R] into one file, 5622 \f[CB]common.classlist\f[R]: 5623 .RS 5624 .PP 5625 \f[CB]type\ hello.classlist\ hi.classlist\ >\ common.classlist\f[R] 5626 .RE 5627 .RE 5628 .IP "3." 3 5629 Create a shared archive named \f[CB]common.jsa\f[R] that contains all the 5630 classes in \f[CB]common.classlist\f[R]: 5631 .RS 4 5632 .RS 5633 .PP 5634 \f[CB]java\ \-Xshare:dump\ \-XX:SharedArchiveFile=common.jsa\ \-XX:SharedClassListFile=common.classlist\ \-cp\ common.jar:hello.jar:hi.jar\f[R] 5635 .RE 5636 .PP 5637 The classpath parameter used is the common class path prefix shared by 5638 the \f[CB]Hello\f[R] and \f[CB]Hi\f[R] applications. 5639 .RE 5640 .IP "4." 3 5641 Run the \f[CB]Hello\f[R] and \f[CB]Hi\f[R] applications with the same shared 5642 archive: 5643 .RS 4 5644 .RS 5645 .PP 5646 \f[CB]java\ \-XX:SharedArchiveFile=common.jsa\ \-cp\ common.jar:hello.jar:hi.jar\ Hello\f[R] 5647 .RE 5648 .RS 5649 .PP 5650 \f[CB]java\ \-XX:SharedArchiveFile=common.jsa\ \-cp\ common.jar:hello.jar:hi.jar\ Hi\f[R] 5651 .RE 5652 .RE 5653 .SS Specifying Additional Shared Data Added to an Archive File 5654 .PP 5655 The \f[CB]SharedArchiveConfigFile\f[R] option is used to specify 5656 additional shared data to add to the archive file. 5657 .RS 5658 .PP 5659 \f[CB]\-XX:SharedArchiveConfigFile=\f[R]\f[I]shared_config_file\f[R] 5660 .RE 5661 .PP 5662 JDK 9 and later supports adding both symbols and\ string objects to an 5663 archive for memory sharing\ when you have multiple JVM processes running 5664 on the same host. 5665 An example of this is having multiple JVM processes that use the same 5666 set of Java EE classes. 5667 When these common classes are loaded and used, new symbols and strings 5668 may be created and added to the JVM\[aq]s internal "symbol" and "string" 5669 tables.\ At runtime, the symbols or string objects mapped from the 5670 archive file can be shared across multiple JVM processes, resulting in a 5671 reduction of overall memory usage.\ In addition, archiving strings also 5672 provides added performance benefits in both startup time and runtime 5673 execution. 5674 .PP 5675 In JDK 10 and later, CONSTANT_String entries in archived classes are 5676 resolved to interned String objects at dump time, and all interned 5677 String objects are archived. 5678 However, even though all CONSTANT_String literals in all archived 5679 classes are resolved, it might still beneficial to add additional 5680 strings that are not string literals in class files, but are likely to 5681 be used by your application at run time. 5682 .PP 5683 Symbol data should be generated by the \f[CB]jcmd\f[R] tool attaching to a 5684 running JVM process. 5685 See \f[B]jcmd\f[R]. 5686 .PP 5687 The following is an example of the symbol dumping command in 5688 \f[CB]jcmd\f[R]:\ 5689 .RS 5690 .PP 5691 \f[CB]jcmd\f[R] \f[I]pid\f[R] \f[CB]VM.symboltable\ \-verbose\f[R] 5692 .RE 5693 .RS 5694 .PP 5695 \f[B]Note:\f[R] The first line (process ID) and the second line 5696 (\f[CB]\@VERSION\ ...\f[R]) of this \f[CB]jcmd\f[R] output should be 5697 excluded from the configuration file. 5698 .RE 5699 .SS Example of a Configuration File 5700 .PP 5701 The following is an example of a configuration file: 5702 .IP 5703 .nf 5704 \f[CB] 5705 VERSION:\ 1.0 5706 \@SECTION:\ Symbol 5707 10\ \-1:\ linkMethod 5708 \f[R] 5709 .fi 5710 .PP 5711 In the configuration file example, the \f[CB]\@SECTION:\ Symbol\f[R] entry 5712 uses the following format: 5713 .RS 5714 .PP 5715 \f[I]length\f[R] \f[I]refcount\f[R]\f[CB]:\f[R] \f[I]symbol\f[R] 5716 .RE 5717 .PP 5718 The \f[I]refcount\f[R] for a shared symbol is always \f[CB]\-1\f[R]. 5719 .PP 5720 \f[CB]\@SECTION\f[R] specifies the type of the section that follows it. 5721 All data within the section must be the same type that\[aq]s specified 5722 by \f[CB]\@SECTION\f[R]. 5723 Different types of data can\[aq]t be mixed. 5724 Multiple separated data sections for the same type specified by 5725 different \f[CB]\@SECTION\f[R] are allowed within one 5726 \f[CB]shared_config_file\f[R] . 5727 .SH PERFORMANCE TUNING EXAMPLES 5728 .PP 5729 You can use the Java advanced runtime options to optimize the 5730 performance of your applications. 5731 .SS Tuning for Higher Throughput 5732 .PP 5733 Use the following commands and advanced options to achieve higher 5734 throughput performance for your application: 5735 .RS 5736 .PP 5737 \f[CB]java\ \-server\ \-XX:+UseParallelGC\ \-XX:+UseLargePages\ \-Xmn10g\ \ \-Xms26g\ \-Xmx26g\f[R] 5738 .RE 5739 .SS Tuning for Lower Response Time 5740 .PP 5741 Use the following commands and advanced options to achieve lower 5742 response times for your application: 5743 .RS 5744 .PP 5745 \f[CB]java\ \-XX:+UseG1GC\ \-XX:MaxGCPauseMillis=100\f[R] 5746 .RE 5747 .SS Keeping the Java Heap Small and Reducing the Dynamic Footprint of 5748 Embedded Applications 5749 .PP 5750 Use the following advanced runtime options to keep the Java heap small 5751 and reduce the dynamic footprint of embedded applications: 5752 .RS 5753 .PP 5754 \f[CB]\-XX:MaxHeapFreeRatio=10\ \-XX:MinHeapFreeRatio=5\f[R] 5755 .RE 5756 .RS 5757 .PP 5758 \f[B]Note:\f[R] The defaults for these two options are 70% and 40% 5759 respectively. 5760 Because performance sacrifices can occur when using these small 5761 settings, you should optimize for a small footprint by reducing these 5762 settings as much as possible without introducing unacceptable 5763 performance degradation. 5764 .RE 5765 .SH EXIT STATUS 5766 .PP 5767 The following exit values are typically returned by the launcher when 5768 the launcher is called with the wrong arguments, serious errors, or 5769 exceptions thrown by the JVM. 5770 However, a Java application may choose to return any value by using the 5771 API call \f[CB]System.exit(exitValue)\f[R]. 5772 The values are: 5773 .IP \[bu] 2 5774 \f[CB]0\f[R]: Successful completion 5775 .IP \[bu] 2 5776 \f[CB]>0\f[R]: An error occurred