1 '\" t
   2 .\" Copyright (c) 1994, 2018, 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 .\" Title: java
  24 .\" Language: English
  25 .\" Date: 03 March 2015
  26 .\" SectDesc: Basic Tools
  27 .\" Software: JDK 8
  28 .\" Arch: generic
  29 .\" Part Number: E38207-04
  30 .\" Doc ID: JSSON
  31 .\"
  32 .if n .pl 99999
  33 .TH "java" "1" "03 March 2015" "JDK 8" "Basic Tools"
  34 .\" -----------------------------------------------------------------
  35 .\" * Define some portability stuff
  36 .\" -----------------------------------------------------------------
  37 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38 .\" http://bugs.debian.org/507673
  39 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  40 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41 .ie \n(.g .ds Aq \(aq
  42 .el       .ds Aq '
  43 .\" -----------------------------------------------------------------
  44 .\" * set default formatting
  45 .\" -----------------------------------------------------------------
  46 .\" disable hyphenation
  47 .nh
  48 .\" disable justification (adjust text to left margin only)
  49 .ad l
  50 .\" -----------------------------------------------------------------
  51 .\" * MAIN CONTENT STARTS HERE *
  52 .\" -----------------------------------------------------------------
  53 .SH "NAME"
  54 java \- Launches a Java application\&.
  55 .SH "SYNOPSIS"
  56 .sp
  57 .if n \{\
  58 .RS 4
  59 .\}
  60 .nf
  61 \fBjava\fR [\fIoptions\fR] \fIclassname\fR [\fIargs\fR]
  62 .fi
  63 .if n \{\
  64 .RE
  65 .\}
  66 .sp
  67 .if n \{\
  68 .RS 4
  69 .\}
  70 .nf
  71 \fBjava\fR [\fIoptions\fR] \fB\-jar\fR \fIfilename\fR [\fIargs\fR]
  72 .fi
  73 .if n \{\
  74 .RE
  75 .\}
  76 .PP
  77 \fIoptions\fR
  78 .RS 4
  79 Command\-line options separated by spaces\&. See Options\&.
  80 .RE
  81 .PP
  82 \fIclassname\fR
  83 .RS 4
  84 The name of the class to be launched\&.
  85 .RE
  86 .PP
  87 \fIfilename\fR
  88 .RS 4
  89 The name of the Java Archive (JAR) file to be called\&. Used only with the
  90 \fB\-jar\fR
  91 option\&.
  92 .RE
  93 .PP
  94 \fIargs\fR
  95 .RS 4
  96 The arguments passed to the
  97 \fBmain()\fR
  98 method separated by spaces\&.
  99 .RE
 100 .SH "DESCRIPTION"
 101 .PP
 102 The
 103 \fBjava\fR
 104 command starts a Java application\&. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class\*(Aqs
 105 \fBmain()\fR
 106 method\&. The method must be declared
 107 \fIpublic\fR
 108 and
 109 \fIstatic\fR, it must not return any value, and it must accept a
 110 \fBString\fR
 111 array as a parameter\&. The method declaration has the following form:
 112 .sp
 113 .if n \{\
 114 .RS 4
 115 .\}
 116 .nf
 117 \fBpublic static void main(String[] args)\fR
 118  
 119 .fi
 120 .if n \{\
 121 .RE
 122 .\}
 123 .PP
 124 The
 125 \fBjava\fR
 126 command can be used to launch a JavaFX application by loading a class that either has a
 127 \fBmain()\fR
 128 method or that extends
 129 \fBjavafx\&.application\&.Application\fR\&. In the latter case, the launcher constructs an instance of the
 130 \fBApplication\fR
 131 class, calls its
 132 \fBinit()\fR
 133 method, and then calls the
 134 \fBstart(javafx\&.stage\&.Stage)\fR
 135 method\&.
 136 .PP
 137 By default, the first argument that is not an option of the
 138 \fBjava\fR
 139 command is the fully qualified name of the class to be called\&. If the
 140 \fB\-jar\fR
 141 option is specified, its argument is the name of the JAR file containing class and resource files for the application\&. The startup class must be indicated by the
 142 \fBMain\-Class\fR
 143 manifest header in its source code\&.
 144 .PP
 145 The JRE searches for the startup class (and other classes used by the application) in three sets of locations: the bootstrap class path, the installed extensions, and the user\(cqs class path\&.
 146 .PP
 147 Arguments after the class file name or the JAR file name are passed to the
 148 \fBmain()\fR
 149 method\&.
 150 .SH "OPTIONS"
 151 .PP
 152 The
 153 \fBjava\fR
 154 command supports a wide range of options that can be divided into the following categories:
 155 .sp
 156 .RS 4
 157 .ie n \{\
 158 \h'-04'\(bu\h'+03'\c
 159 .\}
 160 .el \{\
 161 .sp -1
 162 .IP \(bu 2.3
 163 .\}
 164 Standard Options
 165 .RE
 166 .sp
 167 .RS 4
 168 .ie n \{\
 169 \h'-04'\(bu\h'+03'\c
 170 .\}
 171 .el \{\
 172 .sp -1
 173 .IP \(bu 2.3
 174 .\}
 175 Non\-Standard Options
 176 .RE
 177 .sp
 178 .RS 4
 179 .ie n \{\
 180 \h'-04'\(bu\h'+03'\c
 181 .\}
 182 .el \{\
 183 .sp -1
 184 .IP \(bu 2.3
 185 .\}
 186 Advanced Runtime Options
 187 .RE
 188 .sp
 189 .RS 4
 190 .ie n \{\
 191 \h'-04'\(bu\h'+03'\c
 192 .\}
 193 .el \{\
 194 .sp -1
 195 .IP \(bu 2.3
 196 .\}
 197 Advanced JIT Compiler Options
 198 .RE
 199 .sp
 200 .RS 4
 201 .ie n \{\
 202 \h'-04'\(bu\h'+03'\c
 203 .\}
 204 .el \{\
 205 .sp -1
 206 .IP \(bu 2.3
 207 .\}
 208 Advanced Serviceability Options
 209 .RE
 210 .sp
 211 .RS 4
 212 .ie n \{\
 213 \h'-04'\(bu\h'+03'\c
 214 .\}
 215 .el \{\
 216 .sp -1
 217 .IP \(bu 2.3
 218 .\}
 219 Advanced Garbage Collection Options
 220 .RE
 221 .PP
 222 Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM)\&. They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on\&.
 223 .PP
 224 Non\-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change\&. These options start with
 225 \fB\-X\fR\&.
 226 .PP
 227 Advanced options are not recommended for casual use\&. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters\&. They are also not guaranteed to be supported by all JVM implementations, and are subject to change\&. Advanced options start with
 228 \fB\-XX\fR\&.
 229 .PP
 230 To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document\&.
 231 .PP
 232 Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default\&. Such options do not require a parameter\&. Boolean
 233 \fB\-XX\fR
 234 options are enabled using the plus sign (\fB\-XX:+\fR\fIOptionName\fR) and disabled using the minus sign (\fB\-XX:\-\fR\fIOptionName\fR)\&.
 235 .PP
 236 For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option)\&. If you are expected to specify the size in bytes, you can use no suffix, or use the suffix
 237 \fBk\fR
 238 or
 239 \fBK\fR
 240 for kilobytes (KB),
 241 \fBm\fR
 242 or
 243 \fBM\fR
 244 for megabytes (MB),
 245 \fBg\fR
 246 or
 247 \fBG\fR
 248 for gigabytes (GB)\&. For example, to set the size to 8 GB, you can specify either
 249 \fB8g\fR,
 250 \fB8192m\fR,
 251 \fB8388608k\fR, or
 252 \fB8589934592\fR
 253 as the argument\&. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify
 254 \fB0\&.25\fR
 255 for 25%)\&.
 256 .SS "Standard Options"
 257 .PP
 258 These are the most commonly used options that are supported by all implementations of the JVM\&.
 259 .PP
 260 \-agentlib:\fIlibname\fR[=\fIoptions\fR]
 261 .RS 4
 262 Loads the specified native agent library\&. After the library name, a comma\-separated list of options specific to the library can be used\&.
 263 .sp
 264 If the option
 265 \fB\-agentlib:foo\fR
 266 is specified, then the JVM attempts to load the library named
 267 \fBlibfoo\&.so\fR
 268 in the location specified by the
 269 \fBLD_LIBRARY_PATH\fR
 270 system variable (on OS X this variable is
 271 \fBDYLD_LIBRARY_PATH\fR)\&.
 272 .sp
 273 The following example shows how to load the heap profiling tool (HPROF) library and get sample CPU information every 20 ms, with a stack depth of 3:
 274 .sp
 275 .if n \{\
 276 .RS 4
 277 .\}
 278 .nf
 279 \fB\-agentlib:hprof=cpu=samples,interval=20,depth=3\fR
 280  
 281 .fi
 282 .if n \{\
 283 .RE
 284 .\}
 285 The following example shows how to load the Java Debug Wire Protocol (JDWP) library and listen for the socket connection on port 8000, suspending the JVM before the main class loads:
 286 .sp
 287 .if n \{\
 288 .RS 4
 289 .\}
 290 .nf
 291 \fB\-agentlib:jdwp=transport=dt_socket,server=y,address=8000\fR
 292  
 293 .fi
 294 .if n \{\
 295 .RE
 296 .\}
 297 For more information about the native agent libraries, refer to the following:
 298 .sp
 299 .RS 4
 300 .ie n \{\
 301 \h'-04'\(bu\h'+03'\c
 302 .\}
 303 .el \{\
 304 .sp -1
 305 .IP \(bu 2.3
 306 .\}
 307 The
 308 \fBjava\&.lang\&.instrument\fR
 309 package description at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
 310 .RE
 311 .sp
 312 .RS 4
 313 .ie n \{\
 314 \h'-04'\(bu\h'+03'\c
 315 .\}
 316 .el \{\
 317 .sp -1
 318 .IP \(bu 2.3
 319 .\}
 320 Agent Command Line Options in the JVM Tools Interface guide at http://docs\&.oracle\&.com/javase/8/docs/platform/jvmti/jvmti\&.html#starting
 321 .RE
 322 .RE
 323 .PP
 324 \-agentpath:\fIpathname\fR[=\fIoptions\fR]
 325 .RS 4
 326 Loads the native agent library specified by the absolute path name\&. This option is equivalent to
 327 \fB\-agentlib\fR
 328 but uses the full path and file name of the library\&.
 329 .RE
 330 .PP
 331 \-client
 332 .RS 4
 333 Selects the Java HotSpot Client VM\&. The 64\-bit version of the Java SE Development Kit (JDK) currently ignores this option and instead uses the Server JVM\&.
 334 .sp
 335 For default JVM selection, see Server\-Class Machine Detection at
 336 http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
 337 .RE
 338 .PP
 339 \-D\fIproperty\fR=\fIvalue\fR
 340 .RS 4
 341 Sets a system property value\&. The
 342 \fIproperty\fR
 343 variable is a string with no spaces that represents the name of the property\&. The
 344 \fIvalue\fR
 345 variable is a string that represents the value of the property\&. If
 346 \fIvalue\fR
 347 is a string with spaces, then enclose it in quotation marks (for example
 348 \fB\-Dfoo="foo bar"\fR)\&.
 349 .RE
 350 .PP
 351 \-d32
 352 .RS 4
 353 Runs the application in a 32\-bit environment\&. If a 32\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
 354 .RE
 355 .PP
 356 \-d64
 357 .RS 4
 358 Runs the application in a 64\-bit environment\&. If a 64\-bit environment is not installed or is not supported, then an error will be reported\&. By default, the application is run in a 32\-bit environment unless a 64\-bit system is used\&.
 359 .sp
 360 Currently only the Java HotSpot Server VM supports 64\-bit operation, and the
 361 \fB\-server\fR
 362 option is implicit with the use of
 363 \fB\-d64\fR\&. The
 364 \fB\-client\fR
 365 option is ignored with the use of
 366 \fB\-d64\fR\&. This is subject to change in a future release\&.
 367 .RE
 368 .PP
 369 \-disableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 370 .br
 371 \-da[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 372 .RS 4
 373 Disables assertions\&. By default, assertions are disabled in all packages and classes\&.
 374 .sp
 375 With no arguments,
 376 \fB\-disableassertions\fR
 377 (\fB\-da\fR) disables assertions in all packages and classes\&. With the
 378 \fIpackagename\fR
 379 argument ending in
 380 \fB\&.\&.\&.\fR, the switch disables assertions in the specified package and any subpackages\&. If the argument is simply
 381 \fB\&.\&.\&.\fR, then the switch disables assertions in the unnamed package in the current working directory\&. With the
 382 \fIclassname\fR
 383 argument, the switch disables assertions in the specified class\&.
 384 .sp
 385 The
 386 \fB\-disableassertions\fR
 387 (\fB\-da\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to disable assertions in all classes except for system classes\&. The
 388 \fB\-disablesystemassertions\fR
 389 option enables you to disable assertions in all system classes\&.
 390 .sp
 391 To explicitly enable assertions in specific packages or classes, use the
 392 \fB\-enableassertions\fR
 393 (\fB\-ea\fR) option\&. Both options can be used at the same time\&. For example, to run the
 394 \fBMyClass\fR
 395 application with assertions enabled in package
 396 \fBcom\&.wombat\&.fruitbat\fR
 397 (and any subpackages) but disabled in class
 398 \fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
 399 .sp
 400 .if n \{\
 401 .RS 4
 402 .\}
 403 .nf
 404 \fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
 405  
 406 .fi
 407 .if n \{\
 408 .RE
 409 .\}
 410 .RE
 411 .PP
 412 \-disablesystemassertions
 413 .br
 414 \-dsa
 415 .RS 4
 416 Disables assertions in all system classes\&.
 417 .RE
 418 .PP
 419 \-enableassertions[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 420 .br
 421 \-ea[:[\fIpackagename\fR]\&.\&.\&.|:\fIclassname\fR]
 422 .RS 4
 423 Enables assertions\&. By default, assertions are disabled in all packages and classes\&.
 424 .sp
 425 With no arguments,
 426 \fB\-enableassertions\fR
 427 (\fB\-ea\fR) enables assertions in all packages and classes\&. With the
 428 \fIpackagename\fR
 429 argument ending in
 430 \fB\&.\&.\&.\fR, the switch enables assertions in the specified package and any subpackages\&. If the argument is simply
 431 \fB\&.\&.\&.\fR, then the switch enables assertions in the unnamed package in the current working directory\&. With the
 432 \fIclassname\fR
 433 argument, the switch enables assertions in the specified class\&.
 434 .sp
 435 The
 436 \fB\-enableassertions\fR
 437 (\fB\-ea\fR) option applies to all class loaders and to system classes (which do not have a class loader)\&. There is one exception to this rule: if the option is provided with no arguments, then it does not apply to system classes\&. This makes it easy to enable assertions in all classes except for system classes\&. The
 438 \fB\-enablesystemassertions\fR
 439 option provides a separate switch to enable assertions in all system classes\&.
 440 .sp
 441 To explicitly disable assertions in specific packages or classes, use the
 442 \fB\-disableassertions\fR
 443 (\fB\-da\fR) option\&. If a single command contains multiple instances of these switches, then they are processed in order before loading any classes\&. For example, to run the
 444 \fBMyClass\fR
 445 application with assertions enabled only in package
 446 \fBcom\&.wombat\&.fruitbat\fR
 447 (and any subpackages) but disabled in class
 448 \fBcom\&.wombat\&.fruitbat\&.Brickbat\fR, use the following command:
 449 .sp
 450 .if n \{\
 451 .RS 4
 452 .\}
 453 .nf
 454 \fBjava \-ea:com\&.wombat\&.fruitbat\&.\&.\&. \-da:com\&.wombat\&.fruitbat\&.Brickbat MyClass\fR
 455  
 456 .fi
 457 .if n \{\
 458 .RE
 459 .\}
 460 .RE
 461 .PP
 462 \-enablesystemassertions
 463 .br
 464 \-esa
 465 .RS 4
 466 Enables assertions in all system classes\&.
 467 .RE
 468 .PP
 469 \-help
 470 .br
 471 \-?
 472 .RS 4
 473 Displays usage information for the
 474 \fBjava\fR
 475 command without actually running the JVM\&.
 476 .RE
 477 .PP
 478 \-jar \fIfilename\fR
 479 .RS 4
 480 Executes a program encapsulated in a JAR file\&. The
 481 \fIfilename\fR
 482 argument is the name of a JAR file with a manifest that contains a line in the form
 483 \fBMain\-Class:\fR\fIclassname\fR
 484 that defines the class with the
 485 \fBpublic static void main(String[] args)\fR
 486 method that serves as your application\*(Aqs starting point\&.
 487 .sp
 488 When you use the
 489 \fB\-jar\fR
 490 option, the specified JAR file is the source of all user classes, and other class path settings are ignored\&.
 491 .sp
 492 For more information about JAR files, see the following resources:
 493 .sp
 494 .RS 4
 495 .ie n \{\
 496 \h'-04'\(bu\h'+03'\c
 497 .\}
 498 .el \{\
 499 .sp -1
 500 .IP \(bu 2.3
 501 .\}
 502 jar(1)
 503 .RE
 504 .sp
 505 .RS 4
 506 .ie n \{\
 507 \h'-04'\(bu\h'+03'\c
 508 .\}
 509 .el \{\
 510 .sp -1
 511 .IP \(bu 2.3
 512 .\}
 513 The Java Archive (JAR) Files guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/jar/index\&.html
 514 .RE
 515 .sp
 516 .RS 4
 517 .ie n \{\
 518 \h'-04'\(bu\h'+03'\c
 519 .\}
 520 .el \{\
 521 .sp -1
 522 .IP \(bu 2.3
 523 .\}
 524 Lesson: Packaging Programs in JAR Files at
 525 
 526 http://docs\&.oracle\&.com/javase/tutorial/deployment/jar/index\&.html
 527 .RE
 528 .RE
 529 .PP
 530 \-javaagent:\fIjarpath\fR[=\fIoptions\fR]
 531 .RS 4
 532 Loads the specified Java programming language agent\&. For more information about instrumenting Java applications, see the
 533 \fBjava\&.lang\&.instrument\fR
 534 package description in the Java API documentation at http://docs\&.oracle\&.com/javase/8/docs/api/java/lang/instrument/package\-summary\&.html
 535 .RE
 536 .PP
 537 \-jre\-restrict\-search
 538 .RS 4
 539 Includes user\-private JREs in the version search\&.
 540 .RE
 541 .PP
 542 \-no\-jre\-restrict\-search
 543 .RS 4
 544 Excludes user\-private JREs from the version search\&.
 545 .RE
 546 .PP
 547 \-server
 548 .RS 4
 549 Selects the Java HotSpot Server VM\&. The 64\-bit version of the JDK supports only the Server VM, so in that case the option is implicit\&.
 550 .sp
 551 For default JVM selection, see Server\-Class Machine Detection at
 552 http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/server\-class\&.html
 553 .RE
 554 .PP
 555 \-showversion
 556 .RS 4
 557 Displays version information and continues execution of the application\&. This option is equivalent to the
 558 \fB\-version\fR
 559 option except that the latter instructs the JVM to exit after displaying version information\&.
 560 .RE
 561 .PP
 562 \-splash:\fIimgname\fR
 563 .RS 4
 564 Shows the splash screen with the image specified by
 565 \fIimgname\fR\&. For example, to show the
 566 \fBsplash\&.gif\fR
 567 file from the
 568 \fBimages\fR
 569 directory when starting your application, use the following option:
 570 .sp
 571 .if n \{\
 572 .RS 4
 573 .\}
 574 .nf
 575 \fB\-splash:images/splash\&.gif\fR
 576  
 577 .fi
 578 .if n \{\
 579 .RE
 580 .\}
 581 .RE
 582 .PP
 583 \-verbose:class
 584 .RS 4
 585 Displays information about each loaded class\&.
 586 .RE
 587 .PP
 588 \-verbose:gc
 589 .RS 4
 590 Displays information about each garbage collection (GC) event\&.
 591 .RE
 592 .PP
 593 \-verbose:jni
 594 .RS 4
 595 Displays information about the use of native methods and other Java Native Interface (JNI) activity\&.
 596 .RE
 597 .PP
 598 \-version
 599 .RS 4
 600 Displays version information and then exits\&. This option is equivalent to the
 601 \fB\-showversion\fR
 602 option except that the latter does not instruct the JVM to exit after displaying version information\&.
 603 .RE
 604 .PP
 605 \-version:\fIrelease\fR
 606 .RS 4
 607 Specifies the release version to be used for running the application\&. If the version of the
 608 \fBjava\fR
 609 command called does not meet this specification and an appropriate implementation is found on the system, then the appropriate implementation will be used\&.
 610 .sp
 611 The
 612 \fIrelease\fR
 613 argument specifies either the exact version string, or a list of version strings and ranges separated by spaces\&. A
 614 \fIversion string\fR
 615 is the developer designation of the version number in the following form:
 616 \fB1\&.\fR\fIx\fR\fB\&.0_\fR\fIu\fR
 617 (where
 618 \fIx\fR
 619 is the major version number, and
 620 \fIu\fR
 621 is the update version number)\&. A
 622 \fIversion range\fR
 623 is made up of a version string followed by a plus sign (\fB+\fR) to designate this version or later, or a part of a version string followed by an asterisk (\fB*\fR) to designate any version string with a matching prefix\&. Version strings and ranges can be combined using a space for a logical
 624 \fIOR\fR
 625 combination, or an ampersand (\fB&\fR) for a logical
 626 \fIAND\fR
 627 combination of two version strings/ranges\&. For example, if running the class or JAR file requires either JRE 6u13 (1\&.6\&.0_13), or any JRE 6 starting from 6u10 (1\&.6\&.0_10), specify the following:
 628 .sp
 629 .if n \{\
 630 .RS 4
 631 .\}
 632 .nf
 633 \fB\-version:"1\&.6\&.0_13 1\&.6* & 1\&.6\&.0_10+"\fR
 634  
 635 .fi
 636 .if n \{\
 637 .RE
 638 .\}
 639 Quotation marks are necessary only if there are spaces in the
 640 \fIrelease\fR
 641 parameter\&.
 642 .sp
 643 For JAR files, the preference is to specify version requirements in the JAR file manifest rather than on the command line\&.
 644 .RE
 645 .SS "Non\-Standard Options"
 646 .PP
 647 These options are general purpose options that are specific to the Java HotSpot Virtual Machine\&.
 648 .PP
 649 \-X
 650 .RS 4
 651 Displays help for all available
 652 \fB\-X\fR
 653 options\&.
 654 .RE
 655 .PP
 656 \-Xbatch
 657 .RS 4
 658 Disables background compilation\&. By default, the JVM compiles the method as a background task, running the method in interpreter mode until the background compilation is finished\&. The
 659 \fB\-Xbatch\fR
 660 flag disables background compilation so that compilation of all methods proceeds as a foreground task until completed\&.
 661 .sp
 662 This option is equivalent to
 663 \fB\-XX:\-BackgroundCompilation\fR\&.
 664 .RE
 665 .PP
 666 \-Xbootclasspath:\fIpath\fR
 667 .RS 4
 668 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to search for boot class files\&. These are used in place of the boot class files included in the JDK\&.
 669 .sp
 670 Do not deploy applications that use this option to override a class in
 671 \fBrt\&.jar\fR, because this violates the JRE binary code license\&.
 672 .RE
 673 .PP
 674 \-Xbootclasspath/a:\fIpath\fR
 675 .RS 4
 676 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to append to the end of the default bootstrap class path\&.
 677 .sp
 678 Do not deploy applications that use this option to override a class in
 679 \fBrt\&.jar\fR, because this violates the JRE binary code license\&.
 680 .RE
 681 .PP
 682 \-Xbootclasspath/p:\fIpath\fR
 683 .RS 4
 684 Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) to prepend to the front of the default bootstrap class path\&.
 685 .sp
 686 Do not deploy applications that use this option to override a class in
 687 \fBrt\&.jar\fR, because this violates the JRE binary code license\&.
 688 .RE
 689 .PP
 690 \-Xcheck:jni
 691 .RS 4
 692 Performs additional checks for Java Native Interface (JNI) functions\&. Specifically, it validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request\&. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with an irrecoverable error in such cases\&. Expect a performance degradation when this option is used\&.
 693 .RE
 694 .PP
 695 \-Xcomp
 696 .RS 4
 697 Forces compilation of methods on first invocation\&. By default, the Client VM (\fB\-client\fR) performs 1,000 interpreted method invocations and the Server VM (\fB\-server\fR) performs 10,000 interpreted method invocations to gather information for efficient compilation\&. Specifying the
 698 \fB\-Xcomp\fR
 699 option disables interpreted method invocations to increase compilation performance at the expense of efficiency\&.
 700 .sp
 701 You can also change the number of interpreted method invocations before compilation using the
 702 \fB\-XX:CompileThreshold\fR
 703 option\&.
 704 .RE
 705 .PP
 706 \-Xdebug
 707 .RS 4
 708 Does nothing\&. Provided for backward compatibility\&.
 709 .RE
 710 .PP
 711 \-Xdiag
 712 .RS 4
 713 Shows additional diagnostic messages\&.
 714 .RE
 715 .PP
 716 \-Xfuture
 717 .RS 4
 718 Enables strict class\-file format checks that enforce close conformance to the class\-file format specification\&. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases\&.
 719 .RE
 720 .PP
 721 \-Xint
 722 .RS 4
 723 Runs the application in interpreted\-only mode\&. Compilation to native code is disabled, and all bytecode is executed by the interpreter\&. The performance benefits offered by the just in time (JIT) compiler are not present in this mode\&.
 724 .RE
 725 .PP
 726 \-Xinternalversion
 727 .RS 4
 728 Displays more detailed JVM version information than the
 729 \fB\-version\fR
 730 option, and then exits\&.
 731 .RE
 732 .PP
 733 \-Xloggc:\fIfilename\fR
 734 .RS 4
 735 Sets the file to which verbose GC events information should be redirected for logging\&. The information written to this file is similar to the output of
 736 \fB\-verbose:gc\fR
 737 with the time elapsed since the first GC event preceding each logged event\&. The
 738 \fB\-Xloggc\fR
 739 option overrides
 740 \fB\-verbose:gc\fR
 741 if both are given with the same
 742 \fBjava\fR
 743 command\&.
 744 .sp
 745 Example:
 746 .sp
 747 .if n \{\
 748 .RS 4
 749 .\}
 750 .nf
 751 \fB\-Xloggc:garbage\-collection\&.log\fR
 752  
 753 .fi
 754 .if n \{\
 755 .RE
 756 .\}
 757 .RE
 758 .PP
 759 \-Xmaxjitcodesize=\fIsize\fR
 760 .RS 4
 761 Specifies the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
 762 \fBk\fR
 763 or
 764 \fBK\fR
 765 to indicate kilobytes,
 766 \fBm\fR
 767 or
 768 \fBM\fR
 769 to indicate megabytes,
 770 \fBg\fR
 771 or
 772 \fBG\fR
 773 to indicate gigabytes\&. The default maximum code cache size is 240 MB; if you disable tiered compilation with the option
 774 \fB\-XX:\-TieredCompilation\fR, then the default size is 48 MB:
 775 .sp
 776 .if n \{\
 777 .RS 4
 778 .\}
 779 .nf
 780 \fB\-Xmaxjitcodesize=240m\fR
 781  
 782 .fi
 783 .if n \{\
 784 .RE
 785 .\}
 786 This option is equivalent to
 787 \fB\-XX:ReservedCodeCacheSize\fR\&.
 788 .RE
 789 .PP
 790 \-Xmixed
 791 .RS 4
 792 Executes all bytecode by the interpreter except for hot methods, which are compiled to native code\&.
 793 .RE
 794 .PP
 795 \-Xmn\fIsize\fR
 796 .RS 4
 797 Sets the initial and maximum size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
 798 \fBk\fR
 799 or
 800 \fBK\fR
 801 to indicate kilobytes,
 802 \fBm\fR
 803 or
 804 \fBM\fR
 805 to indicate megabytes,
 806 \fBg\fR
 807 or
 808 \fBG\fR
 809 to indicate gigabytes\&.
 810 .sp
 811 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too small, then a lot of minor garbage collections will be performed\&. If the size is too large, then only full garbage collections will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
 812 .sp
 813 The following examples show how to set the initial and maximum size of young generation to 256 MB using various units:
 814 .sp
 815 .if n \{\
 816 .RS 4
 817 .\}
 818 .nf
 819 \fB\-Xmn256m\fR
 820 \fB\-Xmn262144k\fR
 821 \fB\-Xmn268435456\fR
 822  
 823 .fi
 824 .if n \{\
 825 .RE
 826 .\}
 827 Instead of the
 828 \fB\-Xmn\fR
 829 option to set both the initial and maximum size of the heap for the young generation, you can use
 830 \fB\-XX:NewSize\fR
 831 to set the initial size and
 832 \fB\-XX:MaxNewSize\fR
 833 to set the maximum size\&.
 834 .RE
 835 .PP
 836 \-Xms\fIsize\fR
 837 .RS 4
 838 Sets the initial size (in bytes) of the heap\&. This value must be a multiple of 1024 and greater than 1 MB\&. Append the letter
 839 \fBk\fR
 840 or
 841 \fBK\fR
 842 to indicate kilobytes,
 843 \fBm\fR
 844 or
 845 \fBM\fR
 846 to indicate megabytes,
 847 \fBg\fR
 848 or
 849 \fBG\fR
 850 to indicate gigabytes\&.
 851 .sp
 852 The following examples show how to set the size of allocated memory to 6 MB using various units:
 853 .sp
 854 .if n \{\
 855 .RS 4
 856 .\}
 857 .nf
 858 \fB\-Xms6291456\fR
 859 \fB\-Xms6144k\fR
 860 \fB\-Xms6m\fR
 861  
 862 .fi
 863 .if n \{\
 864 .RE
 865 .\}
 866 If you do not set this option, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The initial size of the heap for the young generation can be set using the
 867 \fB\-Xmn\fR
 868 option or the
 869 \fB\-XX:NewSize\fR
 870 option\&.
 871 .RE
 872 .PP
 873 \-Xmx\fIsize\fR
 874 .RS 4
 875 Specifies the maximum size (in bytes) of the memory allocation pool in bytes\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
 876 \fBk\fR
 877 or
 878 \fBK\fR
 879 to indicate kilobytes,
 880 \fBm\fR
 881 or
 882 \fBM\fR
 883 to indicate megabytes,
 884 \fBg\fR
 885 or
 886 \fBG\fR
 887 to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
 888 \fB\-Xms\fR
 889 and
 890 \fB\-Xmx\fR
 891 are often set to the same value\&. See the section "Ergonomics" in
 892 \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR
 893 at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
 894 .sp
 895 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
 896 .sp
 897 .if n \{\
 898 .RS 4
 899 .\}
 900 .nf
 901 \fB\-Xmx83886080\fR
 902 \fB\-Xmx81920k\fR
 903 \fB\-Xmx80m\fR
 904  
 905 .fi
 906 .if n \{\
 907 .RE
 908 .\}
 909 The
 910 \fB\-Xmx\fR
 911 option is equivalent to
 912 \fB\-XX:MaxHeapSize\fR\&.
 913 .RE
 914 .PP
 915 \-Xnoclassgc
 916 .RS 4
 917 Disables garbage collection (GC) of classes\&. This can save some GC time, which shortens interruptions during the application run\&.
 918 .sp
 919 When you specify
 920 \fB\-Xnoclassgc\fR
 921 at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
 922 .RE
 923 .PP
 924 \-Xprof
 925 .RS 4
 926 Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
 927 .RE
 928 .PP
 929 \-Xrs
 930 .RS 4
 931 Reduces the use of operating system signals by the JVM\&.
 932 .sp
 933 Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing database connections) at shutdown, even if the JVM terminates abruptly\&.
 934 .sp
 935 The JVM catches signals to implement shutdown hooks for unexpected termination\&. The JVM uses
 936 \fBSIGHUP\fR,
 937 \fBSIGINT\fR, and
 938 \fBSIGTERM\fR
 939 to initiate the running of shutdown hooks\&.
 940 .sp
 941 The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes\&. The JVM uses
 942 \fBSIGQUIT\fR
 943 to perform thread dumps\&.
 944 .sp
 945 Applications embedding the JVM frequently need to trap signals such as
 946 \fBSIGINT\fR
 947 or
 948 \fBSIGTERM\fR, which can lead to interference with the JVM signal handlers\&. The
 949 \fB\-Xrs\fR
 950 option is available to address this issue\&. When
 951 \fB\-Xrs\fR
 952 is used, the signal masks for
 953 \fBSIGINT\fR,
 954 \fBSIGTERM\fR,
 955 \fBSIGHUP\fR, and
 956 \fBSIGQUIT\fR
 957 are not changed by the JVM, and signal handlers for these signals are not installed\&.
 958 .sp
 959 There are two consequences of specifying
 960 \fB\-Xrs\fR:
 961 .sp
 962 .RS 4
 963 .ie n \{\
 964 \h'-04'\(bu\h'+03'\c
 965 .\}
 966 .el \{\
 967 .sp -1
 968 .IP \(bu 2.3
 969 .\}
 970 \fBSIGQUIT\fR
 971 thread dumps are not available\&.
 972 .RE
 973 .sp
 974 .RS 4
 975 .ie n \{\
 976 \h'-04'\(bu\h'+03'\c
 977 .\}
 978 .el \{\
 979 .sp -1
 980 .IP \(bu 2.3
 981 .\}
 982 User code is responsible for causing shutdown hooks to run, for example, by calling
 983 \fBSystem\&.exit()\fR
 984 when the JVM is to be terminated\&.
 985 .RE
 986 .RE
 987 .PP
 988 \-Xshare:\fImode\fR
 989 .RS 4
 990 Sets the class data sharing (CDS) mode\&. Possible
 991 \fImode\fR
 992 arguments for this option include the following:
 993 .PP
 994 auto
 995 .RS 4
 996 Use CDS if possible\&. This is the default value for Java HotSpot 32\-Bit Client VM\&.
 997 .RE
 998 .PP
 999 on
1000 .RS 4
1001 Require the use of CDS\&. Print an error message and exit if class data sharing cannot be used\&.
1002 .RE
1003 .PP
1004 off
1005 .RS 4
1006 Do not use CDS\&. This is the default value for Java HotSpot 32\-Bit Server VM, Java HotSpot 64\-Bit Client VM, and Java HotSpot 64\-Bit Server VM\&.
1007 .RE
1008 .PP
1009 dump
1010 .RS 4
1011 Manually generate the CDS archive\&. Specify the application class path as described in "Setting the Class Path "\&.
1012 .sp
1013 You should regenerate the CDS archive with each new JDK release\&.
1014 .RE
1015 .RE
1016 .PP
1017 \-XshowSettings:\fIcategory\fR
1018 .RS 4
1019 Shows settings and continues\&. Possible
1020 \fIcategory\fR
1021 arguments for this option include the following:
1022 .PP
1023 all
1024 .RS 4
1025 Shows all categories of settings\&. This is the default value\&.
1026 .RE
1027 .PP
1028 locale
1029 .RS 4
1030 Shows settings related to locale\&.
1031 .RE
1032 .PP
1033 properties
1034 .RS 4
1035 Shows settings related to system properties\&.
1036 .RE
1037 .PP
1038 vm
1039 .RS 4
1040 Shows the settings of the JVM\&.
1041 .RE
1042 .RE
1043 .PP
1044 \-Xss\fIsize\fR
1045 .RS 4
1046 Sets the thread stack size (in bytes)\&. Append the letter
1047 \fBk\fR
1048 or
1049 \fBK\fR
1050 to indicate KB,
1051 \fBm\fR
1052 or
1053 \fBM\fR
1054 to indicate MB,
1055 \fBg\fR
1056 or
1057 \fBG\fR
1058 to indicate GB\&. The default value depends on the platform:
1059 .sp
1060 .RS 4
1061 .ie n \{\
1062 \h'-04'\(bu\h'+03'\c
1063 .\}
1064 .el \{\
1065 .sp -1
1066 .IP \(bu 2.3
1067 .\}
1068 Linux/ARM (32\-bit): 320 KB
1069 .RE
1070 .sp
1071 .RS 4
1072 .ie n \{\
1073 \h'-04'\(bu\h'+03'\c
1074 .\}
1075 .el \{\
1076 .sp -1
1077 .IP \(bu 2.3
1078 .\}
1079 Linux/i386 (32\-bit): 320 KB
1080 .RE
1081 .sp
1082 .RS 4
1083 .ie n \{\
1084 \h'-04'\(bu\h'+03'\c
1085 .\}
1086 .el \{\
1087 .sp -1
1088 .IP \(bu 2.3
1089 .\}
1090 Linux/x64 (64\-bit): 1024 KB
1091 .RE
1092 .sp
1093 .RS 4
1094 .ie n \{\
1095 \h'-04'\(bu\h'+03'\c
1096 .\}
1097 .el \{\
1098 .sp -1
1099 .IP \(bu 2.3
1100 .\}
1101 OS X (64\-bit): 1024 KB
1102 .RE
1103 .sp
1104 .RS 4
1105 .ie n \{\
1106 \h'-04'\(bu\h'+03'\c
1107 .\}
1108 .el \{\
1109 .sp -1
1110 .IP \(bu 2.3
1111 .\}
1112 Oracle Solaris/i386 (32\-bit): 320 KB
1113 .RE
1114 .sp
1115 .RS 4
1116 .ie n \{\
1117 \h'-04'\(bu\h'+03'\c
1118 .\}
1119 .el \{\
1120 .sp -1
1121 .IP \(bu 2.3
1122 .\}
1123 Oracle Solaris/x64 (64\-bit): 1024 KB
1124 .RE
1125 .sp
1126 The following examples set the thread stack size to 1024 KB in different units:
1127 .sp
1128 .if n \{\
1129 .RS 4
1130 .\}
1131 .nf
1132 \fB\-Xss1m\fR
1133 \fB\-Xss1024k\fR
1134 \fB\-Xss1048576\fR
1135  
1136 .fi
1137 .if n \{\
1138 .RE
1139 .\}
1140 This option is equivalent to
1141 \fB\-XX:ThreadStackSize\fR\&.
1142 .RE
1143 .PP
1144 \-Xusealtsigs
1145 .RS 4
1146 Use alternative signals instead of
1147 \fBSIGUSR1\fR
1148 and
1149 \fBSIGUSR2\fR
1150 for JVM internal signals\&. This option is equivalent to
1151 \fB\-XX:+UseAltSigs\fR\&.
1152 .RE
1153 .PP
1154 \-Xverify:\fImode\fR
1155 .RS 4
1156 Sets the mode of the bytecode verifier\&. Bytecode verification helps to troubleshoot some problems, but it also adds overhead to the running application\&. Possible
1157 \fImode\fR
1158 arguments for this option include the following:
1159 .PP
1160 none
1161 .RS 4
1162 Do not verify the bytecode\&. This reduces startup time and also reduces the protection provided by Java\&.
1163 .RE
1164 .PP
1165 remote
1166 .RS 4
1167 Verify those classes that are not loaded by the bootstrap class loader\&. This is the default behavior if you do not specify the
1168 \fB\-Xverify\fR
1169 option\&.
1170 .RE
1171 .PP
1172 all
1173 .RS 4
1174 Verify all classes\&.
1175 .RE
1176 .RE
1177 .SS "Advanced Runtime Options"
1178 .PP
1179 These options control the runtime behavior of the Java HotSpot VM\&.
1180 .PP
1181 \-XX:+DisableAttachMechanism
1182 .RS 4
1183 Enables the option that disables the mechanism that lets tools attach to the JVM\&. By default, this option is disabled, meaning that the attach mechanism is enabled and you can use tools such as
1184 \fBjcmd\fR,
1185 \fBjstack\fR,
1186 \fBjmap\fR, and
1187 \fBjinfo\fR\&.
1188 .RE
1189 .PP
1190 \-XX:ErrorFile=\fIfilename\fR
1191 .RS 4
1192 Specifies the path and file name to which error data is written when an irrecoverable error occurs\&. By default, this file is created in the current working directory and named
1193 \fBhs_err_pid\fR\fIpid\fR\fB\&.log\fR
1194 where
1195 \fIpid\fR
1196 is the identifier of the process that caused the error\&. The following example shows how to set the default log file (note that the identifier of the process is specified as
1197 \fB%p\fR):
1198 .sp
1199 .if n \{\
1200 .RS 4
1201 .\}
1202 .nf
1203 \fB\-XX:ErrorFile=\&./hs_err_pid%p\&.log\fR
1204  
1205 .fi
1206 .if n \{\
1207 .RE
1208 .\}
1209 The following example shows how to set the error log to
1210 \fB/var/log/java/java_error\&.log\fR:
1211 .sp
1212 .if n \{\
1213 .RS 4
1214 .\}
1215 .nf
1216 \fB\-XX:ErrorFile=/var/log/java/java_error\&.log\fR
1217  
1218 .fi
1219 .if n \{\
1220 .RE
1221 .\}
1222 If the file cannot be created in the specified directory (due to insufficient space, permission problem, or another issue), then the file is created in the temporary directory for the operating system\&. The temporary directory is
1223 \fB/tmp\fR\&.
1224 .RE
1225 .PP
1226 \-XX:+FailOverToOldVerifier
1227 .RS 4
1228 Enables automatic failover to the old verifier when the new type checker fails\&. By default, this option is disabled and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
1229 .RE
1230 .PP
1231 \-XX:LargePageSizeInBytes=\fIsize\fR
1232 .RS 4
1233 On Solaris, sets the maximum size (in bytes) for large pages used for Java heap\&. The
1234 \fIsize\fR
1235 argument must be a power of 2 (2, 4, 8, 16, \&.\&.\&.)\&. Append the letter
1236 \fBk\fR
1237 or
1238 \fBK\fR
1239 to indicate kilobytes,
1240 \fBm\fR
1241 or
1242 \fBM\fR
1243 to indicate megabytes,
1244 \fBg\fR
1245 or
1246 \fBG\fR
1247 to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for large pages automatically\&.
1248 .sp
1249 The following example illustrates how to set the large page size to 4 megabytes (MB):
1250 .sp
1251 .if n \{\
1252 .RS 4
1253 .\}
1254 .nf
1255 \fB\-XX:LargePageSizeInBytes=4m\fR
1256  
1257 .fi
1258 .if n \{\
1259 .RE
1260 .\}
1261 .RE
1262 .PP
1263 \-XX:MaxDirectMemorySize=\fIsize\fR
1264 .RS 4
1265 Sets the maximum total size (in bytes) of the New I/O (the
1266 \fBjava\&.nio\fR
1267 package) direct\-buffer allocations\&. Append the letter
1268 \fBk\fR
1269 or
1270 \fBK\fR
1271 to indicate kilobytes,
1272 \fBm\fR
1273 or
1274 \fBM\fR
1275 to indicate megabytes,
1276 \fBg\fR
1277 or
1278 \fBG\fR
1279 to indicate gigabytes\&. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct\-buffer allocations automatically\&.
1280 .sp
1281 The following examples illustrate how to set the NIO size to 1024 KB in different units:
1282 .sp
1283 .if n \{\
1284 .RS 4
1285 .\}
1286 .nf
1287 \fB\-XX:MaxDirectMemorySize=1m\fR
1288 \fB\-XX:MaxDirectMemorySize=1024k\fR
1289 \fB\-XX:MaxDirectMemorySize=1048576\fR
1290  
1291 .fi
1292 .if n \{\
1293 .RE
1294 .\}
1295 .RE
1296 .PP
1297 \-XX:NativeMemoryTracking=\fImode\fR
1298 .RS 4
1299 Specifies the mode for tracking JVM native memory usage\&. Possible
1300 \fImode\fR
1301 arguments for this option include the following:
1302 .PP
1303 off
1304 .RS 4
1305 Do not track JVM native memory usage\&. This is the default behavior if you do not specify the
1306 \fB\-XX:NativeMemoryTracking\fR
1307 option\&.
1308 .RE
1309 .PP
1310 summary
1311 .RS 4
1312 Only track memory usage by JVM subsystems, such as Java heap, class, code, and thread\&.
1313 .RE
1314 .PP
1315 detail
1316 .RS 4
1317 In addition to tracking memory usage by JVM subsystems, track memory usage by individual
1318 \fBCallSite\fR, individual virtual memory region and its committed regions\&.
1319 .RE
1320 .RE
1321 .PP
1322 \-XX:ObjectAlignmentInBytes=\fIalignment\fR
1323 .RS 4
1324 Sets the memory alignment of Java objects (in bytes)\&. By default, the value is set to 8 bytes\&. The specified value should be a power of two, and must be within the range of 8 and 256 (inclusive)\&. This option makes it possible to use compressed pointers with large Java heap sizes\&.
1325 .sp
1326 The heap size limit in bytes is calculated as:
1327 .sp
1328 \fB4GB * ObjectAlignmentInBytes\fR
1329 .sp
1330 Note: As the alignment value increases, the unused space between objects will also increase\&. As a result, you may not realize any benefits from using compressed pointers with large Java heap sizes\&.
1331 .RE
1332 .PP
1333 \-XX:OnError=\fIstring\fR
1334 .RS 4
1335 Sets a custom command or a series of semicolon\-separated commands to run when an irrecoverable error occurs\&. If the string contains spaces, then it must be enclosed in quotation marks\&.
1336 .sp
1337 The following example shows how the
1338 \fB\-XX:OnError\fR
1339 option can be used to run the
1340 \fBgcore\fR
1341 command to create the core image, and the debugger is started to attach to the process in case of an irrecoverable error (the
1342 \fB%p\fR
1343 designates the current process):
1344 .sp
1345 .if n \{\
1346 .RS 4
1347 .\}
1348 .nf
1349 \fB\-XX:OnError="gcore %p;dbx \- %p"\fR
1350  
1351 .fi
1352 .if n \{\
1353 .RE
1354 .\}
1355 .RE
1356 .PP
1357 \-XX:OnOutOfMemoryError=\fIstring\fR
1358 .RS 4
1359 Sets a custom command or a series of semicolon\-separated commands to run when an
1360 \fBOutOfMemoryError\fR
1361 exception is first thrown\&. If the string contains spaces, then it must be enclosed in quotation marks\&. For an example of a command string, see the description of the
1362 \fB\-XX:OnError\fR
1363 option\&.
1364 .RE
1365 .PP
1366 \-XX:+PerfDataSaveToFile
1367 .RS 4
1368 If enabled, saves
1369 jstat(1) binary data when the Java application exits\&. This binary data is saved in a file named
1370 \fBhsperfdata_\fR\fI<pid>\fR, where
1371 \fI<pid>\fR
1372 is the process identifier of the Java application you ran\&. Use
1373 \fBjstat\fR
1374 to display the performance data contained in this file as follows:
1375 .sp
1376 .if n \{\
1377 .RS 4
1378 .\}
1379 .nf
1380 \fBjstat \-class file:///\fR\fB\fI<path>\fR\fR\fB/hsperfdata_\fR\fB\fI<pid>\fR\fR
1381 \fBjstat \-gc file:///\fR\fB\fI<path>\fR\fR\fB/hsperfdata_\fR\fB\fI<pid>\fR\fR
1382 .fi
1383 .if n \{\
1384 .RE
1385 .\}
1386 .RE
1387 .PP
1388 \-XX:+PrintCommandLineFlags
1389 .RS 4
1390 Enables printing of ergonomically selected JVM flags that appeared on the command line\&. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector\&. By default, this option is disabled and flags are not printed\&.
1391 .RE
1392 .PP
1393 \-XX:+PrintNMTStatistics
1394 .RS 4
1395 Enables printing of collected native memory tracking data at JVM exit when native memory tracking is enabled (see
1396 \fB\-XX:NativeMemoryTracking\fR)\&. By default, this option is disabled and native memory tracking data is not printed\&.
1397 .RE
1398 .PP
1399 \-XX:+RelaxAccessControlCheck
1400 .RS 4
1401 Decreases the amount of access control checks in the verifier\&. By default, this option is disabled, and it is ignored (that is, treated as disabled) for classes with a recent bytecode version\&. You can enable it for classes with older versions of the bytecode\&.
1402 .RE
1403 .PP
1404 \-XX:+ShowMessageBoxOnError
1405 .RS 4
1406 Enables displaying of a dialog box when the JVM experiences an irrecoverable error\&. This prevents the JVM from exiting and keeps the process active so that you can attach a debugger to it to investigate the cause of the error\&. By default, this option is disabled\&.
1407 .RE
1408 .PP
1409 \-XX:ThreadStackSize=\fIsize\fR
1410 .RS 4
1411 Sets the thread stack size (in bytes)\&. Append the letter
1412 \fBk\fR
1413 or
1414 \fBK\fR
1415 to indicate kilobytes,
1416 \fBm\fR
1417 or
1418 \fBM\fR
1419 to indicate megabytes,
1420 \fBg\fR
1421 or
1422 \fBG\fR
1423 to indicate gigabytes\&. The default value depends on the platform:
1424 .sp
1425 .RS 4
1426 .ie n \{\
1427 \h'-04'\(bu\h'+03'\c
1428 .\}
1429 .el \{\
1430 .sp -1
1431 .IP \(bu 2.3
1432 .\}
1433 Linux/ARM (32\-bit): 320 KB
1434 .RE
1435 .sp
1436 .RS 4
1437 .ie n \{\
1438 \h'-04'\(bu\h'+03'\c
1439 .\}
1440 .el \{\
1441 .sp -1
1442 .IP \(bu 2.3
1443 .\}
1444 Linux/i386 (32\-bit): 320 KB
1445 .RE
1446 .sp
1447 .RS 4
1448 .ie n \{\
1449 \h'-04'\(bu\h'+03'\c
1450 .\}
1451 .el \{\
1452 .sp -1
1453 .IP \(bu 2.3
1454 .\}
1455 Linux/x64 (64\-bit): 1024 KB
1456 .RE
1457 .sp
1458 .RS 4
1459 .ie n \{\
1460 \h'-04'\(bu\h'+03'\c
1461 .\}
1462 .el \{\
1463 .sp -1
1464 .IP \(bu 2.3
1465 .\}
1466 OS X (64\-bit): 1024 KB
1467 .RE
1468 .sp
1469 .RS 4
1470 .ie n \{\
1471 \h'-04'\(bu\h'+03'\c
1472 .\}
1473 .el \{\
1474 .sp -1
1475 .IP \(bu 2.3
1476 .\}
1477 Oracle Solaris/i386 (32\-bit): 320 KB
1478 .RE
1479 .sp
1480 .RS 4
1481 .ie n \{\
1482 \h'-04'\(bu\h'+03'\c
1483 .\}
1484 .el \{\
1485 .sp -1
1486 .IP \(bu 2.3
1487 .\}
1488 Oracle Solaris/x64 (64\-bit): 1024 KB
1489 .RE
1490 .sp
1491 The following examples show how to set the thread stack size to 1024 KB in different units:
1492 .sp
1493 .if n \{\
1494 .RS 4
1495 .\}
1496 .nf
1497 \fB\-XX:ThreadStackSize=1m\fR
1498 \fB\-XX:ThreadStackSize=1024k\fR
1499 \fB\-XX:ThreadStackSize=1048576\fR
1500  
1501 .fi
1502 .if n \{\
1503 .RE
1504 .\}
1505 This option is equivalent to
1506 \fB\-Xss\fR\&.
1507 .RE
1508 .PP
1509 \-XX:+TraceClassLoading
1510 .RS 4
1511 Enables tracing of classes as they are loaded\&. By default, this option is disabled and classes are not traced\&.
1512 .RE
1513 .PP
1514 \-XX:+TraceClassLoadingPreorder
1515 .RS 4
1516 Enables tracing of all loaded classes in the order in which they are referenced\&. By default, this option is disabled and classes are not traced\&.
1517 .RE
1518 .PP
1519 \-XX:+TraceClassResolution
1520 .RS 4
1521 Enables tracing of constant pool resolutions\&. By default, this option is disabled and constant pool resolutions are not traced\&.
1522 .RE
1523 .PP
1524 \-XX:+TraceClassUnloading
1525 .RS 4
1526 Enables tracing of classes as they are unloaded\&. By default, this option is disabled and classes are not traced\&.
1527 .RE
1528 .PP
1529 \-XX:+TraceLoaderConstraints
1530 .RS 4
1531 Enables tracing of the loader constraints recording\&. By default, this option is disabled and loader constraints recording is not traced\&.
1532 .RE
1533 .PP
1534 \-XX:+UseAltSigs
1535 .RS 4
1536 Enables the use of alternative signals instead of
1537 \fBSIGUSR1\fR
1538 and
1539 \fBSIGUSR2\fR
1540 for JVM internal signals\&. By default, this option is disabled and alternative signals are not used\&. This option is equivalent to
1541 \fB\-Xusealtsigs\fR\&.
1542 .RE
1543 .PP
1544 \-XX:\-UseBiasedLocking
1545 .RS 4
1546 Disables the use of biased locking\&. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled, whereas applications with certain patterns of locking may see slowdowns\&. For more information about the biased locking technique, see the example in Java Tuning White Paper at http://www\&.oracle\&.com/technetwork/java/tuning\-139912\&.html#section4\&.2\&.5
1547 .sp
1548 By default, this option is enabled\&.
1549 .RE
1550 .PP
1551 \-XX:\-UseCompressedOops
1552 .RS 4
1553 Disables the use of compressed pointers\&. By default, this option is enabled, and compressed pointers are used when Java heap sizes are less than 32 GB\&. When this option is enabled, object references are represented as 32\-bit offsets instead of 64\-bit pointers, which typically increases performance when running the application with Java heap sizes less than 32 GB\&. This option works only for 64\-bit JVMs\&.
1554 .sp
1555 It is also possible to use compressed pointers when Java heap sizes are greater than 32GB\&. See the
1556 \fB\-XX:ObjectAlignmentInBytes\fR
1557 option\&.
1558 .RE
1559 .PP
1560 \-XX:+UseHugeTLBFS
1561 .RS 4
1562 This option for Linux is the equivalent of specifying
1563 \fB\-XX:+UseLargePages\fR\&. This option is disabled by default\&. This option pre\-allocates all large pages up\-front, when memory is reserved; consequently the JVM cannot dynamically grow or shrink large pages memory areas; see
1564 \fB\-XX:UseTransparentHugePages\fR
1565 if you want this behavior\&.
1566 .sp
1567 For more information, see "Large Pages"\&.
1568 .RE
1569 .PP
1570 \-XX:+UseLargePages
1571 .RS 4
1572 Enables the use of large page memory\&. By default, this option is disabled and large page memory is not used\&.
1573 .sp
1574 For more information, see "Large Pages"\&.
1575 .RE
1576 .PP
1577 \-XX:+UseMembar
1578 .RS 4
1579 Enables issuing of membars on thread state transitions\&. This option is disabled by default on all platforms except ARM servers, where it is enabled\&. (It is recommended that you do not disable this option on ARM servers\&.)
1580 .RE
1581 .PP
1582 \-XX:+UsePerfData
1583 .RS 4
1584 Enables the
1585 \fBperfdata\fR
1586 feature\&. This option is enabled by default to allow JVM monitoring and performance testing\&. Disabling it suppresses the creation of the
1587 \fBhsperfdata_userid\fR
1588 directories\&. To disable the
1589 \fBperfdata\fR
1590 feature, specify
1591 \fB\-XX:\-UsePerfData\fR\&.
1592 .RE
1593 .PP
1594 \-XX:+UseTransparentHugePages
1595 .RS 4
1596 On Linux, enables the use of large pages that can dynamically grow or shrink\&. This option is disabled by default\&. You may encounter performance problems with transparent huge pages as the OS moves other pages around to create huge pages; this option is made available for experimentation\&.
1597 .sp
1598 For more information, see "Large Pages"\&.
1599 .RE
1600 .PP
1601 \-XX:+AllowUserSignalHandlers
1602 .RS 4
1603 Enables installation of signal handlers by the application\&. By default, this option is disabled and the application is not allowed to install signal handlers\&.
1604 .RE
1605 .SS "Advanced JIT Compiler Options"
1606 .PP
1607 These options control the dynamic just\-in\-time (JIT) compilation performed by the Java HotSpot VM\&.
1608 .PP
1609 \-XX:AllocateInstancePrefetchLines=\fIlines\fR
1610 .RS 4
1611 Sets the number of lines to prefetch ahead of the instance allocation pointer\&. By default, the number of lines to prefetch is set to 1:
1612 .sp
1613 .if n \{\
1614 .RS 4
1615 .\}
1616 .nf
1617 \fB\-XX:AllocateInstancePrefetchLines=1\fR
1618  
1619 .fi
1620 .if n \{\
1621 .RE
1622 .\}
1623 Only the Java HotSpot Server VM supports this option\&.
1624 .RE
1625 .PP
1626 \-XX:AllocatePrefetchDistance=\fIsize\fR
1627 .RS 4
1628 Sets the size (in bytes) of the prefetch distance for object allocation\&. Memory about to be written with the value of new objects is prefetched up to this distance starting from the address of the last allocated object\&. Each Java thread has its own allocation point\&.
1629 .sp
1630 Negative values denote that prefetch distance is chosen based on the platform\&. Positive values are bytes to prefetch\&. Append the letter
1631 \fBk\fR
1632 or
1633 \fBK\fR
1634 to indicate kilobytes,
1635 \fBm\fR
1636 or
1637 \fBM\fR
1638 to indicate megabytes,
1639 \fBg\fR
1640 or
1641 \fBG\fR
1642 to indicate gigabytes\&. The default value is set to \-1\&.
1643 .sp
1644 The following example shows how to set the prefetch distance to 1024 bytes:
1645 .sp
1646 .if n \{\
1647 .RS 4
1648 .\}
1649 .nf
1650 \fB\-XX:AllocatePrefetchDistance=1024\fR
1651  
1652 .fi
1653 .if n \{\
1654 .RE
1655 .\}
1656 Only the Java HotSpot Server VM supports this option\&.
1657 .RE
1658 .PP
1659 \-XX:AllocatePrefetchInstr=\fIinstruction\fR
1660 .RS 4
1661 Sets the prefetch instruction to prefetch ahead of the allocation pointer\&. Only the Java HotSpot Server VM supports this option\&. Possible values are from 0 to 3\&. The actual instructions behind the values depend on the platform\&. By default, the prefetch instruction is set to 0:
1662 .sp
1663 .if n \{\
1664 .RS 4
1665 .\}
1666 .nf
1667 \fB\-XX:AllocatePrefetchInstr=0\fR
1668  
1669 .fi
1670 .if n \{\
1671 .RE
1672 .\}
1673 Only the Java HotSpot Server VM supports this option\&.
1674 .RE
1675 .PP
1676 \-XX:AllocatePrefetchLines=\fIlines\fR
1677 .RS 4
1678 Sets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code\&. The default value is 1 if the last allocated object was an instance, and 3 if it was an array\&.
1679 .sp
1680 The following example shows how to set the number of loaded cache lines to 5:
1681 .sp
1682 .if n \{\
1683 .RS 4
1684 .\}
1685 .nf
1686 \fB\-XX:AllocatePrefetchLines=5\fR
1687  
1688 .fi
1689 .if n \{\
1690 .RE
1691 .\}
1692 Only the Java HotSpot Server VM supports this option\&.
1693 .RE
1694 .PP
1695 \-XX:AllocatePrefetchStepSize=\fIsize\fR
1696 .RS 4
1697 Sets the step size (in bytes) for sequential prefetch instructions\&. Append the letter
1698 \fBk\fR
1699 or
1700 \fBK\fR
1701 to indicate kilobytes,
1702 \fBm\fR
1703 or
1704 \fBM\fR
1705 to indicate megabytes,
1706 \fBg\fR
1707 or
1708 \fBG\fR
1709 to indicate gigabytes\&. By default, the step size is set to 16 bytes:
1710 .sp
1711 .if n \{\
1712 .RS 4
1713 .\}
1714 .nf
1715 \fB\-XX:AllocatePrefetchStepSize=16\fR
1716  
1717 .fi
1718 .if n \{\
1719 .RE
1720 .\}
1721 Only the Java HotSpot Server VM supports this option\&.
1722 .RE
1723 .PP
1724 \-XX:AllocatePrefetchStyle=\fIstyle\fR
1725 .RS 4
1726 Sets the generated code style for prefetch instructions\&. The
1727 \fIstyle\fR
1728 argument is an integer from 0 to 3:
1729 .PP
1730 0
1731 .RS 4
1732 Do not generate prefetch instructions\&.
1733 .RE
1734 .PP
1735 1
1736 .RS 4
1737 Execute prefetch instructions after each allocation\&. This is the default parameter\&.
1738 .RE
1739 .PP
1740 2
1741 .RS 4
1742 Use the thread\-local allocation block (TLAB) watermark pointer to determine when prefetch instructions are executed\&.
1743 .RE
1744 .PP
1745 3
1746 .RS 4
1747 Use BIS instruction on SPARC for allocation prefetch\&.
1748 .RE
1749 .sp
1750 Only the Java HotSpot Server VM supports this option\&.
1751 .RE
1752 .PP
1753 \-XX:+BackgroundCompilation
1754 .RS 4
1755 Enables background compilation\&. This option is enabled by default\&. To disable background compilation, specify
1756 \fB\-XX:\-BackgroundCompilation\fR
1757 (this is equivalent to specifying
1758 \fB\-Xbatch\fR)\&.
1759 .RE
1760 .PP
1761 \-XX:CICompilerCount=\fIthreads\fR
1762 .RS 4
1763 Sets the number of compiler threads to use for compilation\&. By default, the number of threads is set to 2 for the server JVM, to 1 for the client JVM, and it scales to the number of cores if tiered compilation is used\&. The following example shows how to set the number of threads to 2:
1764 .sp
1765 .if n \{\
1766 .RS 4
1767 .\}
1768 .nf
1769 \fB\-XX:CICompilerCount=2\fR
1770  
1771 .fi
1772 .if n \{\
1773 .RE
1774 .\}
1775 .RE
1776 .PP
1777 \-XX:CodeCacheMinimumFreeSpace=\fIsize\fR
1778 .RS 4
1779 Sets the minimum free space (in bytes) required for compilation\&. Append the letter
1780 \fBk\fR
1781 or
1782 \fBK\fR
1783 to indicate kilobytes,
1784 \fBm\fR
1785 or
1786 \fBM\fR
1787 to indicate megabytes,
1788 \fBg\fR
1789 or
1790 \fBG\fR
1791 to indicate gigabytes\&. When less than the minimum free space remains, compiling stops\&. By default, this option is set to 500 KB\&. The following example shows how to set the minimum free space to 1024 MB:
1792 .sp
1793 .if n \{\
1794 .RS 4
1795 .\}
1796 .nf
1797 \fB\-XX:CodeCacheMinimumFreeSpace=1024m\fR
1798  
1799 .fi
1800 .if n \{\
1801 .RE
1802 .\}
1803 .RE
1804 .PP
1805 \-XX:CompileCommand=\fIcommand\fR,\fImethod\fR[,\fIoption\fR]
1806 .RS 4
1807 Specifies a command to perform on a method\&. For example, to exclude the
1808 \fBindexOf()\fR
1809 method of the
1810 \fBString\fR
1811 class from being compiled, use the following:
1812 .sp
1813 .if n \{\
1814 .RS 4
1815 .\}
1816 .nf
1817 \fB\-XX:CompileCommand=exclude,java/lang/String\&.indexOf\fR
1818  
1819 .fi
1820 .if n \{\
1821 .RE
1822 .\}
1823 Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
1824 \fB\-XX:+PrintCompilation\fR
1825 and
1826 \fB\-XX:+LogCompilation\fR
1827 options:
1828 .sp
1829 .if n \{\
1830 .RS 4
1831 .\}
1832 .nf
1833 \fB\-XX:CompileCommand=exclude,java\&.lang\&.String::indexOf\fR
1834  
1835 .fi
1836 .if n \{\
1837 .RE
1838 .\}
1839 If the method is specified without the signature, the command will be applied to all methods with the specified name\&. However, you can also specify the signature of the method in the class file format\&. In this case, you should enclose the arguments in quotation marks, because otherwise the shell treats the semicolon as command end\&. For example, if you want to exclude only the
1840 \fBindexOf(String)\fR
1841 method of the
1842 \fBString\fR
1843 class from being compiled, use the following:
1844 .sp
1845 .if n \{\
1846 .RS 4
1847 .\}
1848 .nf
1849 \fB\-XX:CompileCommand="exclude,java/lang/String\&.indexOf,(Ljava/lang/String;)I"\fR
1850  
1851 .fi
1852 .if n \{\
1853 .RE
1854 .\}
1855 You can also use the asterisk (*) as a wildcard for class and method names\&. For example, to exclude all
1856 \fBindexOf()\fR
1857 methods in all classes from being compiled, use the following:
1858 .sp
1859 .if n \{\
1860 .RS 4
1861 .\}
1862 .nf
1863 \fB\-XX:CompileCommand=exclude,*\&.indexOf\fR
1864  
1865 .fi
1866 .if n \{\
1867 .RE
1868 .\}
1869 The commas and periods are aliases for spaces, making it easier to pass compiler commands through a shell\&. You can pass arguments to
1870 \fB\-XX:CompileCommand\fR
1871 using spaces as separators by enclosing the argument in quotation marks:
1872 .sp
1873 .if n \{\
1874 .RS 4
1875 .\}
1876 .nf
1877 \fB\-XX:CompileCommand="exclude java/lang/String indexOf"\fR
1878  
1879 .fi
1880 .if n \{\
1881 .RE
1882 .\}
1883 Note that after parsing the commands passed on the command line using the
1884 \fB\-XX:CompileCommand\fR
1885 options, the JIT compiler then reads commands from the
1886 \fB\&.hotspot_compiler\fR
1887 file\&. You can add commands to this file or specify a different file using the
1888 \fB\-XX:CompileCommandFile\fR
1889 option\&.
1890 .sp
1891 To add several commands, either specify the
1892 \fB\-XX:CompileCommand\fR
1893 option multiple times, or separate each argument with the newline separator (\fB\en\fR)\&. The following commands are available:
1894 .PP
1895 break
1896 .RS 4
1897 Set a breakpoint when debugging the JVM to stop at the beginning of compilation of the specified method\&.
1898 .RE
1899 .PP
1900 compileonly
1901 .RS 4
1902 Exclude all methods from compilation except for the specified method\&. As an alternative, you can use the
1903 \fB\-XX:CompileOnly\fR
1904 option, which allows to specify several methods\&.
1905 .RE
1906 .PP
1907 dontinline
1908 .RS 4
1909 Prevent inlining of the specified method\&.
1910 .RE
1911 .PP
1912 exclude
1913 .RS 4
1914 Exclude the specified method from compilation\&.
1915 .RE
1916 .PP
1917 help
1918 .RS 4
1919 Print a help message for the
1920 \fB\-XX:CompileCommand\fR
1921 option\&.
1922 .RE
1923 .PP
1924 inline
1925 .RS 4
1926 Attempt to inline the specified method\&.
1927 .RE
1928 .PP
1929 log
1930 .RS 4
1931 Exclude compilation logging (with the
1932 \fB\-XX:+LogCompilation\fR
1933 option) for all methods except for the specified method\&. By default, logging is performed for all compiled methods\&.
1934 .RE
1935 .PP
1936 option
1937 .RS 4
1938 This command can be used to pass a JIT compilation option to the specified method in place of the last argument (\fIoption\fR)\&. The compilation option is set at the end, after the method name\&. For example, to enable the
1939 \fBBlockLayoutByFrequency\fR
1940 option for the
1941 \fBappend()\fR
1942 method of the
1943 \fBStringBuffer\fR
1944 class, use the following:
1945 .sp
1946 .if n \{\
1947 .RS 4
1948 .\}
1949 .nf
1950 \fB\-XX:CompileCommand=option,java/lang/StringBuffer\&.append,BlockLayoutByFrequency\fR
1951  
1952 .fi
1953 .if n \{\
1954 .RE
1955 .\}
1956 You can specify multiple compilation options, separated by commas or spaces\&.
1957 .RE
1958 .PP
1959 print
1960 .RS 4
1961 Print generated assembler code after compilation of the specified method\&.
1962 .RE
1963 .PP
1964 quiet
1965 .RS 4
1966 Do not print the compile commands\&. By default, the commands that you specify with the \-\fBXX:CompileCommand\fR
1967 option are printed; for example, if you exclude from compilation the
1968 \fBindexOf()\fR
1969 method of the
1970 \fBString\fR
1971 class, then the following will be printed to standard output:
1972 .sp
1973 .if n \{\
1974 .RS 4
1975 .\}
1976 .nf
1977 \fBCompilerOracle: exclude java/lang/String\&.indexOf\fR
1978  
1979 .fi
1980 .if n \{\
1981 .RE
1982 .\}
1983 You can suppress this by specifying the
1984 \fB\-XX:CompileCommand=quiet\fR
1985 option before other
1986 \fB\-XX:CompileCommand\fR
1987 options\&.
1988 .RE
1989 .RE
1990 .PP
1991 \-XX:CompileCommandFile=\fIfilename\fR
1992 .RS 4
1993 Sets the file from which JIT compiler commands are read\&. By default, the
1994 \fB\&.hotspot_compiler\fR
1995 file is used to store commands performed by the JIT compiler\&.
1996 .sp
1997 Each line in the command file represents a command, a class name, and a method name for which the command is used\&. For example, this line prints assembly code for the
1998 \fBtoString()\fR
1999 method of the
2000 \fBString\fR
2001 class:
2002 .sp
2003 .if n \{\
2004 .RS 4
2005 .\}
2006 .nf
2007 \fBprint java/lang/String toString\fR
2008  
2009 .fi
2010 .if n \{\
2011 .RE
2012 .\}
2013 For more information about specifying the commands for the JIT compiler to perform on methods, see the
2014 \fB\-XX:CompileCommand\fR
2015 option\&.
2016 .RE
2017 .PP
2018 \-XX:CompileOnly=\fImethods\fR
2019 .RS 4
2020 Sets the list of methods (separated by commas) to which compilation should be restricted\&. Only the specified methods will be compiled\&. Specify each method with the full class name (including the packages and subpackages)\&. For example, to compile only the
2021 \fBlength()\fR
2022 method of the
2023 \fBString\fR
2024 class and the
2025 \fBsize()\fR
2026 method of the
2027 \fBList\fR
2028 class, use the following:
2029 .sp
2030 .if n \{\
2031 .RS 4
2032 .\}
2033 .nf
2034 \fB\-XX:CompileOnly=java/lang/String\&.length,java/util/List\&.size\fR
2035  
2036 .fi
2037 .if n \{\
2038 .RE
2039 .\}
2040 Note that the full class name is specified, including all packages and subpackages separated by a slash (\fB/\fR)\&. For easier cut and paste operations, it is also possible to use the method name format produced by the
2041 \fB\-XX:+PrintCompilation\fR
2042 and
2043 \fB\-XX:+LogCompilation\fR
2044 options:
2045 .sp
2046 .if n \{\
2047 .RS 4
2048 .\}
2049 .nf
2050 \fB\-XX:CompileOnly=java\&.lang\&.String::length,java\&.util\&.List::size\fR
2051  
2052 .fi
2053 .if n \{\
2054 .RE
2055 .\}
2056 Although wildcards are not supported, you can specify only the class or package name to compile all methods in that class or package, as well as specify just the method to compile methods with this name in any class:
2057 .sp
2058 .if n \{\
2059 .RS 4
2060 .\}
2061 .nf
2062 \fB\-XX:CompileOnly=java/lang/String\fR
2063 \fB\-XX:CompileOnly=java/lang\fR
2064 \fB\-XX:CompileOnly=\&.length\fR
2065  
2066 .fi
2067 .if n \{\
2068 .RE
2069 .\}
2070 .RE
2071 .PP
2072 \-XX:CompileThreshold=\fIinvocations\fR
2073 .RS 4
2074 Sets the number of interpreted method invocations before compilation\&. By default, in the server JVM, the JIT compiler performs 10,000 interpreted method invocations to gather information for efficient compilation\&. For the client JVM, the default setting is 1,500 invocations\&. This option is ignored when tiered compilation is enabled; see the option
2075 \fB\-XX:+TieredCompilation\fR\&. The following example shows how to set the number of interpreted method invocations to 5,000:
2076 .sp
2077 .if n \{\
2078 .RS 4
2079 .\}
2080 .nf
2081 \fB\-XX:CompileThreshold=5000\fR
2082  
2083 .fi
2084 .if n \{\
2085 .RE
2086 .\}
2087 You can completely disable interpretation of Java methods before compilation by specifying the
2088 \fB\-Xcomp\fR
2089 option\&.
2090 .RE
2091 .PP
2092 \-XX:+DoEscapeAnalysis
2093 .RS 4
2094 Enables the use of escape analysis\&. This option is enabled by default\&. To disable the use of escape analysis, specify
2095 \fB\-XX:\-DoEscapeAnalysis\fR\&. Only the Java HotSpot Server VM supports this option\&.
2096 .RE
2097 .PP
2098 \-XX:InitialCodeCacheSize=\fIsize\fR
2099 .RS 4
2100 Sets the initial code cache size (in bytes)\&. Append the letter
2101 \fBk\fR
2102 or
2103 \fBK\fR
2104 to indicate kilobytes,
2105 \fBm\fR
2106 or
2107 \fBM\fR
2108 to indicate megabytes,
2109 \fBg\fR
2110 or
2111 \fBG\fR
2112 to indicate gigabytes\&. The default value is set to 500 KB\&. The initial code cache size should be not less than the system\*(Aqs minimal memory page size\&. The following example shows how to set the initial code cache size to 32 KB:
2113 .sp
2114 .if n \{\
2115 .RS 4
2116 .\}
2117 .nf
2118 \fB\-XX:InitialCodeCacheSize=32k\fR
2119  
2120 .fi
2121 .if n \{\
2122 .RE
2123 .\}
2124 .RE
2125 .PP
2126 \-XX:+Inline
2127 .RS 4
2128 Enables method inlining\&. This option is enabled by default to increase performance\&. To disable method inlining, specify
2129 \fB\-XX:\-Inline\fR\&.
2130 .RE
2131 .PP
2132 \-XX:InlineSmallCode=\fIsize\fR
2133 .RS 4
2134 Sets the maximum code size (in bytes) for compiled methods that should be inlined\&. Append the letter
2135 \fBk\fR
2136 or
2137 \fBK\fR
2138 to indicate kilobytes,
2139 \fBm\fR
2140 or
2141 \fBM\fR
2142 to indicate megabytes,
2143 \fBg\fR
2144 or
2145 \fBG\fR
2146 to indicate gigabytes\&. Only compiled methods with the size smaller than the specified size will be inlined\&. By default, the maximum code size is set to 1000 bytes:
2147 .sp
2148 .if n \{\
2149 .RS 4
2150 .\}
2151 .nf
2152 \fB\-XX:InlineSmallCode=1000\fR
2153  
2154 .fi
2155 .if n \{\
2156 .RE
2157 .\}
2158 .RE
2159 .PP
2160 \-XX:+LogCompilation
2161 .RS 4
2162 Enables logging of compilation activity to a file named
2163 \fBhotspot\&.log\fR
2164 in the current working directory\&. You can specify a different log file path and name using the
2165 \fB\-XX:LogFile\fR
2166 option\&.
2167 .sp
2168 By default, this option is disabled and compilation activity is not logged\&. The
2169 \fB\-XX:+LogCompilation\fR
2170 option has to be used together with the
2171 \fB\-XX:UnlockDiagnosticVMOptions\fR
2172 option that unlocks diagnostic JVM options\&.
2173 .sp
2174 You can enable verbose diagnostic output with a message printed to the console every time a method is compiled by using the
2175 \fB\-XX:+PrintCompilation\fR
2176 option\&.
2177 .RE
2178 .PP
2179 \-XX:MaxInlineSize=\fIsize\fR
2180 .RS 4
2181 Sets the maximum bytecode size (in bytes) of a method to be inlined\&. Append the letter
2182 \fBk\fR
2183 or
2184 \fBK\fR
2185 to indicate kilobytes,
2186 \fBm\fR
2187 or
2188 \fBM\fR
2189 to indicate megabytes,
2190 \fBg\fR
2191 or
2192 \fBG\fR
2193 to indicate gigabytes\&. By default, the maximum bytecode size is set to 35 bytes:
2194 .sp
2195 .if n \{\
2196 .RS 4
2197 .\}
2198 .nf
2199 \fB\-XX:MaxInlineSize=35\fR
2200  
2201 .fi
2202 .if n \{\
2203 .RE
2204 .\}
2205 .RE
2206 .PP
2207 \-XX:MaxNodeLimit=\fInodes\fR
2208 .RS 4
2209 Sets the maximum number of nodes to be used during single method compilation\&. By default, the maximum number of nodes is set to 65,000:
2210 .sp
2211 .if n \{\
2212 .RS 4
2213 .\}
2214 .nf
2215 \fB\-XX:MaxNodeLimit=65000\fR
2216  
2217 .fi
2218 .if n \{\
2219 .RE
2220 .\}
2221 .RE
2222 .PP
2223 \-XX:MaxTrivialSize=\fIsize\fR
2224 .RS 4
2225 Sets the maximum bytecode size (in bytes) of a trivial method to be inlined\&. Append the letter
2226 \fBk\fR
2227 or
2228 \fBK\fR
2229 to indicate kilobytes,
2230 \fBm\fR
2231 or
2232 \fBM\fR
2233 to indicate megabytes,
2234 \fBg\fR
2235 or
2236 \fBG\fR
2237 to indicate gigabytes\&. By default, the maximum bytecode size of a trivial method is set to 6 bytes:
2238 .sp
2239 .if n \{\
2240 .RS 4
2241 .\}
2242 .nf
2243 \fB\-XX:MaxTrivialSize=6\fR
2244  
2245 .fi
2246 .if n \{\
2247 .RE
2248 .\}
2249 .RE
2250 .PP
2251 \-XX:+OptimizeStringConcat
2252 .RS 4
2253 Enables the optimization of
2254 \fBString\fR
2255 concatenation operations\&. This option is enabled by default\&. To disable the optimization of
2256 \fBString\fR
2257 concatenation operations, specify
2258 \fB\-XX:\-OptimizeStringConcat\fR\&. Only the Java HotSpot Server VM supports this option\&.
2259 .RE
2260 .PP
2261 \-XX:+PrintAssembly
2262 .RS 4
2263 Enables printing of assembly code for bytecoded and native methods by using the external
2264 \fBdisassembler\&.so\fR
2265 library\&. This enables you to see the generated code, which may help you to diagnose performance issues\&.
2266 .sp
2267 By default, this option is disabled and assembly code is not printed\&. The
2268 \fB\-XX:+PrintAssembly\fR
2269 option has to be used together with the
2270 \fB\-XX:UnlockDiagnosticVMOptions\fR
2271 option that unlocks diagnostic JVM options\&.
2272 .RE
2273 .PP
2274 \-XX:+PrintCompilation
2275 .RS 4
2276 Enables verbose diagnostic output from the JVM by printing a message to the console every time a method is compiled\&. This enables you to see which methods actually get compiled\&. By default, this option is disabled and diagnostic output is not printed\&.
2277 .sp
2278 You can also log compilation activity to a file by using the
2279 \fB\-XX:+LogCompilation\fR
2280 option\&.
2281 .RE
2282 .PP
2283 \-XX:+PrintInlining
2284 .RS 4
2285 Enables printing of inlining decisions\&. This enables you to see which methods are getting inlined\&.
2286 .sp
2287 By default, this option is disabled and inlining information is not printed\&. The
2288 \fB\-XX:+PrintInlining\fR
2289 option has to be used together with the
2290 \fB\-XX:+UnlockDiagnosticVMOptions\fR
2291 option that unlocks diagnostic JVM options\&.
2292 .RE
2293 .PP
2294 \-XX:ReservedCodeCacheSize=\fIsize\fR
2295 .RS 4
2296 Sets the maximum code cache size (in bytes) for JIT\-compiled code\&. Append the letter
2297 \fBk\fR
2298 or
2299 \fBK\fR
2300 to indicate kilobytes,
2301 \fBm\fR
2302 or
2303 \fBM\fR
2304 to indicate megabytes,
2305 \fBg\fR
2306 or
2307 \fBG\fR
2308 to indicate gigabytes\&. The default maximum code cache size is 240 MB; if you disable tiered compilation with the option
2309 \fB\-XX:\-TieredCompilation\fR, then the default size is 48 MB\&. This option has a limit of 2 GB; otherwise, an error is generated\&. The maximum code cache size should not be less than the initial code cache size; see the option
2310 \fB\-XX:InitialCodeCacheSize\fR\&. This option is equivalent to
2311 \fB\-Xmaxjitcodesize\fR\&.
2312 .RE
2313 .PP
2314 \-XX:RTMAbortRatio=\fIabort_ratio\fR
2315 .RS 4
2316 The RTM abort ratio is specified as a percentage (%) of all executed RTM transactions\&. If a number of aborted transactions becomes greater than this ratio, then the compiled code will be deoptimized\&. This ratio is used when the
2317 \fB\-XX:+UseRTMDeopt\fR
2318 option is enabled\&. The default value of this option is 50\&. This means that the compiled code will be deoptimized if 50% of all transactions are aborted\&.
2319 .RE
2320 .PP
2321 \-XX:RTMRetryCount=\fInumber_of_retries\fR
2322 .RS 4
2323 RTM locking code will be retried, when it is aborted or busy, the number of times specified by this option before falling back to the normal locking mechanism\&. The default value for this option is 5\&. The
2324 \fB\-XX:UseRTMLocking\fR
2325 option must be enabled\&.
2326 .RE
2327 .PP
2328 \-XX:\-TieredCompilation
2329 .RS 4
2330 Disables the use of tiered compilation\&. By default, this option is enabled\&. Only the Java HotSpot Server VM supports this option\&.
2331 .RE
2332 .PP
2333 \-XX:+UseAES
2334 .RS 4
2335 Enables hardware\-based AES intrinsics for Intel, AMD, and SPARC hardware\&. Intel Westmere (2010 and newer), AMD Bulldozer (2011 and newer), and SPARC (T4 and newer) are the supported hardware\&. UseAES is used in conjunction with UseAESIntrinsics\&.
2336 .RE
2337 .PP
2338 \-XX:+UseAESIntrinsics
2339 .RS 4
2340 UseAES and UseAESIntrinsics flags are enabled by default and are supported only for Java HotSpot Server VM 32\-bit and 64\-bit\&. To disable hardware\-based AES intrinsics, specify
2341 \fB\-XX:\-UseAES \-XX:\-UseAESIntrinsics\fR\&. For example, to enable hardware AES, use the following flags:
2342 .sp
2343 .if n \{\
2344 .RS 4
2345 .\}
2346 .nf
2347 \fB\-XX:+UseAES \-XX:+UseAESIntrinsics\fR
2348  
2349 .fi
2350 .if n \{\
2351 .RE
2352 .\}
2353 To support UseAES and UseAESIntrinsics flags for 32\-bit and 64\-bit use
2354 \fB\-server\fR
2355 option to choose Java HotSpot Server VM\&. These flags are not supported on Client VM\&.
2356 .RE
2357 .PP
2358 \-XX:+UseCodeCacheFlushing
2359 .RS 4
2360 Enables flushing of the code cache before shutting down the compiler\&. This option is enabled by default\&. To disable flushing of the code cache before shutting down the compiler, specify
2361 \fB\-XX:\-UseCodeCacheFlushing\fR\&.
2362 .RE
2363 .PP
2364 \-XX:+UseCondCardMark
2365 .RS 4
2366 Enables checking of whether the card is already marked before updating the card table\&. This option is disabled by default and should only be used on machines with multiple sockets, where it will increase performance of Java applications that rely heavily on concurrent operations\&. Only the Java HotSpot Server VM supports this option\&.
2367 .RE
2368 .PP
2369 \-XX:+UseRTMDeopt
2370 .RS 4
2371 Auto\-tunes RTM locking depending on the abort ratio\&. This ratio is specified by
2372 \fB\-XX:RTMAbortRatio\fR
2373 option\&. If the number of aborted transactions exceeds the abort ratio, then the method containing the lock will be deoptimized and recompiled with all locks as normal locks\&. This option is disabled by default\&. The
2374 \fB\-XX:+UseRTMLocking\fR
2375 option must be enabled\&.
2376 .RE
2377 .PP
2378 \-XX:+UseRTMLocking
2379 .RS 4
2380 Generate Restricted Transactional Memory (RTM) locking code for all inflated locks, with the normal locking mechanism as the fallback handler\&. This option is disabled by default\&. Options related to RTM are only available for the Java HotSpot Server VM on x86 CPUs that support Transactional Synchronization Extensions (TSX)\&.
2381 .sp
2382 RTM is part of Intel\*(Aqs TSX, which is an x86 instruction set extension and facilitates the creation of multithreaded applications\&. RTM introduces the new instructions
2383 \fBXBEGIN\fR,
2384 \fBXABORT\fR,
2385 \fBXEND\fR, and
2386 \fBXTEST\fR\&. The
2387 \fBXBEGIN\fR
2388 and
2389 \fBXEND\fR
2390 instructions enclose a set of instructions to run as a transaction\&. If no conflict is found when running the transaction, the memory and register modifications are committed together at the
2391 \fBXEND\fR
2392 instruction\&. The
2393 \fBXABORT\fR
2394 instruction can be used to explicitly abort a transaction and the
2395 \fBXEND\fR
2396 instruction to check if a set of instructions are being run in a transaction\&.
2397 .sp
2398 A lock on a transaction is inflated when another thread tries to access the same transaction, thereby blocking the thread that did not originally request access to the transaction\&. RTM requires that a fallback set of operations be specified in case a transaction aborts or fails\&. An RTM lock is a lock that has been delegated to the TSX\*(Aqs system\&.
2399 .sp
2400 RTM improves performance for highly contended locks with low conflict in a critical region (which is code that must not be accessed by more than one thread concurrently)\&. RTM also improves the performance of coarse\-grain locking, which typically does not perform well in multithreaded applications\&. (Coarse\-grain locking is the strategy of holding locks for long periods to minimize the overhead of taking and releasing locks, while fine\-grained locking is the strategy of trying to achieve maximum parallelism by locking only when necessary and unlocking as soon as possible\&.) Also, for lightly contended locks that are used by different threads, RTM can reduce false cache line sharing, also known as cache line ping\-pong\&. This occurs when multiple threads from different processors are accessing different resources, but the resources share the same cache line\&. As a result, the processors repeatedly invalidate the cache lines of other processors, which forces them to read from main memory instead of their cache\&.
2401 .RE
2402 .PP
2403 \-XX:+UseSHA
2404 .RS 4
2405 Enables hardware\-based intrinsics for SHA crypto hash functions for SPARC hardware\&.
2406 \fBUseSHA\fR
2407 is used in conjunction with the
2408 \fBUseSHA1Intrinsics\fR,
2409 \fBUseSHA256Intrinsics\fR, and
2410 \fBUseSHA512Intrinsics\fR
2411 options\&.
2412 .sp
2413 The
2414 \fBUseSHA\fR
2415 and
2416 \fBUseSHA*Intrinsics\fR
2417 flags are enabled by default, and are supported only for Java HotSpot Server VM 64\-bit on SPARC T4 and newer\&.
2418 .sp
2419 This feature is only applicable when using the
2420 \fBsun\&.security\&.provider\&.Sun\fR
2421 provider for SHA operations\&.
2422 .sp
2423 To disable all hardware\-based SHA intrinsics, specify
2424 \fB\-XX:\-UseSHA\fR\&. To disable only a particular SHA intrinsic, use the appropriate corresponding option\&. For example:
2425 \fB\-XX:\-UseSHA256Intrinsics\fR\&.
2426 .RE
2427 .PP
2428 \-XX:+UseSHA1Intrinsics
2429 .RS 4
2430 Enables intrinsics for SHA\-1 crypto hash function\&.
2431 .RE
2432 .PP
2433 \-XX:+UseSHA256Intrinsics
2434 .RS 4
2435 Enables intrinsics for SHA\-224 and SHA\-256 crypto hash functions\&.
2436 .RE
2437 .PP
2438 \-XX:+UseSHA512Intrinsics
2439 .RS 4
2440 Enables intrinsics for SHA\-384 and SHA\-512 crypto hash functions\&.
2441 .RE
2442 .PP
2443 \-XX:+UseSuperWord
2444 .RS 4
2445 Enables the transformation of scalar operations into superword operations\&. This option is enabled by default\&. To disable the transformation of scalar operations into superword operations, specify
2446 \fB\-XX:\-UseSuperWord\fR\&. Only the Java HotSpot Server VM supports this option\&.
2447 .RE
2448 .SS "Advanced Serviceability Options"
2449 .PP
2450 These options provide the ability to gather system information and perform extensive debugging\&.
2451 .PP
2452 \-XX:+ExtendedDTraceProbes
2453 .RS 4
2454 Enables additional
2455 \fBdtrace\fR
2456 tool probes that impact the performance\&. By default, this option is disabled and
2457 \fBdtrace\fR
2458 performs only standard probes\&.
2459 .RE
2460 .PP
2461 \-XX:+HeapDumpOnOutOfMemory
2462 .RS 4
2463 Enables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a
2464 \fBjava\&.lang\&.OutOfMemoryError\fR
2465 exception is thrown\&. You can explicitly set the heap dump file path and name using the
2466 \fB\-XX:HeapDumpPath\fR
2467 option\&. By default, this option is disabled and the heap is not dumped when an
2468 \fBOutOfMemoryError\fR
2469 exception is thrown\&.
2470 .RE
2471 .PP
2472 \-XX:HeapDumpPath=\fIpath\fR
2473 .RS 4
2474 Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the
2475 \fB\-XX:+HeapDumpOnOutOfMemoryError\fR
2476 option is set\&. By default, the file is created in the current working directory, and it is named
2477 \fBjava_pid\fR\fIpid\fR\fB\&.hprof\fR
2478 where
2479 \fIpid\fR
2480 is the identifier of the process that caused the error\&. The following example shows how to set the default file explicitly (\fB%p\fR
2481 represents the current process identificator):
2482 .sp
2483 .if n \{\
2484 .RS 4
2485 .\}
2486 .nf
2487 \fB\-XX:HeapDumpPath=\&./java_pid%p\&.hprof\fR
2488  
2489 .fi
2490 .if n \{\
2491 .RE
2492 .\}
2493 The following example shows how to set the heap dump file to
2494 \fB/var/log/java/java_heapdump\&.hprof\fR:
2495 .sp
2496 .if n \{\
2497 .RS 4
2498 .\}
2499 .nf
2500 \fB\-XX:HeapDumpPath=/var/log/java/java_heapdump\&.hprof\fR
2501  
2502 .fi
2503 .if n \{\
2504 .RE
2505 .\}
2506 .RE
2507 .PP
2508 \-XX:LogFile=\fIpath\fR
2509 .RS 4
2510 Sets the path and file name where log data is written\&. By default, the file is created in the current working directory, and it is named
2511 \fBhotspot\&.log\fR\&.
2512 .sp
2513 The following example shows how to set the log file to
2514 \fB/var/log/java/hotspot\&.log\fR:
2515 .sp
2516 .if n \{\
2517 .RS 4
2518 .\}
2519 .nf
2520 \fB\-XX:LogFile=/var/log/java/hotspot\&.log\fR
2521  
2522 .fi
2523 .if n \{\
2524 .RE
2525 .\}
2526 .RE
2527 .PP
2528 \-XX:+PrintClassHistogram
2529 .RS 4
2530 Enables printing of a class instance histogram after a
2531 \fBControl+C\fR
2532 event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
2533 .sp
2534 Setting this option is equivalent to running the
2535 \fBjmap \-histo\fR
2536 command, or the
2537 \fBjcmd \fR\fIpid\fR\fB GC\&.class_histogram\fR
2538 command, where
2539 \fIpid\fR
2540 is the current Java process identifier\&.
2541 .RE
2542 .PP
2543 \-XX:+PrintConcurrentLocks
2544 .RS 4
2545 Enables printing of locks after a event\&. By default, this option is disabled\&.
2546 .sp
2547 Enables printing of
2548 \fBjava\&.util\&.concurrent\fR
2549 locks after a
2550 \fBControl+C\fR
2551 event (\fBSIGTERM\fR)\&. By default, this option is disabled\&.
2552 .sp
2553 Setting this option is equivalent to running the
2554 \fBjstack \-l\fR
2555 command or the
2556 \fBjcmd \fR\fIpid\fR\fB Thread\&.print \-l\fR
2557 command, where
2558 \fIpid\fR
2559 is the current Java process identifier\&.
2560 .RE
2561 .PP
2562 \-XX:+UnlockDiagnosticVMOptions
2563 .RS 4
2564 Unlocks the options intended for diagnosing the JVM\&. By default, this option is disabled and diagnostic options are not available\&.
2565 .RE
2566 .SS "Advanced Garbage Collection Options"
2567 .PP
2568 These options control how garbage collection (GC) is performed by the Java HotSpot VM\&.
2569 .PP
2570 \-XX:+AggressiveHeap
2571 .RS 4
2572 Enables Java heap optimization\&. This sets various parameters to be optimal for long\-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU)\&. By default, the option is disabled and the heap is not optimized\&.
2573 .RE
2574 .PP
2575 \-XX:+AlwaysPreTouch
2576 .RS 4
2577 Enables touching of every page on the Java heap during JVM initialization\&. This gets all pages into the memory before entering the
2578 \fBmain()\fR
2579 method\&. The option can be used in testing to simulate a long\-running system with all virtual memory mapped to physical memory\&. By default, this option is disabled and all pages are committed as JVM heap space fills\&.
2580 .RE
2581 .PP
2582 \-XX:+CMSClassUnloadingEnabled
2583 .RS 4
2584 Enables class unloading when using the concurrent mark\-sweep (CMS) garbage collector\&. This option is enabled by default\&. To disable class unloading for the CMS garbage collector, specify
2585 \fB\-XX:\-CMSClassUnloadingEnabled\fR\&.
2586 .RE
2587 .PP
2588 \-XX:CMSExpAvgFactor=\fIpercent\fR
2589 .RS 4
2590 Sets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics\&. By default, the exponential averages factor is set to 25%\&. The following example shows how to set the factor to 15%:
2591 .sp
2592 .if n \{\
2593 .RS 4
2594 .\}
2595 .nf
2596 \fB\-XX:CMSExpAvgFactor=15\fR
2597  
2598 .fi
2599 .if n \{\
2600 .RE
2601 .\}
2602 .RE
2603 .PP
2604 \-XX:CMSInitiatingOccupancyFraction=\fIpercent\fR
2605 .RS 4
2606 Sets the percentage of the old generation occupancy (0 to 100) at which to start a CMS collection cycle\&. The default value is set to \-1\&. Any negative value (including the default) implies that
2607 \fB\-XX:CMSTriggerRatio\fR
2608 is used to define the value of the initiating occupancy fraction\&.
2609 .sp
2610 The following example shows how to set the occupancy fraction to 20%:
2611 .sp
2612 .if n \{\
2613 .RS 4
2614 .\}
2615 .nf
2616 \fB\-XX:CMSInitiatingOccupancyFraction=20\fR
2617  
2618 .fi
2619 .if n \{\
2620 .RE
2621 .\}
2622 .RE
2623 .PP
2624 \-XX:+CMSScavengeBeforeRemark
2625 .RS 4
2626 Enables scavenging attempts before the CMS remark step\&. By default, this option is disabled\&.
2627 .RE
2628 .PP
2629 \-XX:CMSTriggerRatio=\fIpercent\fR
2630 .RS 4
2631 Sets the percentage (0 to 100) of the value specified by
2632 \fB\-XX:MinHeapFreeRatio\fR
2633 that is allocated before a CMS collection cycle commences\&. The default value is set to 80%\&.
2634 .sp
2635 The following example shows how to set the occupancy fraction to 75%:
2636 .sp
2637 .if n \{\
2638 .RS 4
2639 .\}
2640 .nf
2641 \fB\-XX:CMSTriggerRatio=75\fR
2642  
2643 .fi
2644 .if n \{\
2645 .RE
2646 .\}
2647 .RE
2648 .PP
2649 \-XX:ConcGCThreads=\fIthreads\fR
2650 .RS 4
2651 Sets the number of threads used for concurrent GC\&. The default value depends on the number of CPUs available to the JVM\&.
2652 .sp
2653 For example, to set the number of threads for concurrent GC to 2, specify the following option:
2654 .sp
2655 .if n \{\
2656 .RS 4
2657 .\}
2658 .nf
2659 \fB\-XX:ConcGCThreads=2\fR
2660  
2661 .fi
2662 .if n \{\
2663 .RE
2664 .\}
2665 .RE
2666 .PP
2667 \-XX:+DisableExplicitGC
2668 .RS 4
2669 Enables the option that disables processing of calls to
2670 \fBSystem\&.gc()\fR\&. This option is disabled by default, meaning that calls to
2671 \fBSystem\&.gc()\fR
2672 are processed\&. If processing of calls to
2673 \fBSystem\&.gc()\fR
2674 is disabled, the JVM still performs GC when necessary\&.
2675 .RE
2676 .PP
2677 \-XX:+ExplicitGCInvokesConcurrent
2678 .RS 4
2679 Enables invoking of concurrent GC by using the
2680 \fBSystem\&.gc()\fR
2681 request\&. This option is disabled by default and can be enabled only together with the
2682 \fB\-XX:+UseConcMarkSweepGC\fR
2683 option\&.
2684 .RE
2685 .PP
2686 \-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
2687 .RS 4
2688 Enables invoking of concurrent GC by using the
2689 \fBSystem\&.gc()\fR
2690 request and unloading of classes during the concurrent GC cycle\&. This option is disabled by default and can be enabled only together with the
2691 \fB\-XX:+UseConcMarkSweepGC\fR
2692 option\&.
2693 .RE
2694 .PP
2695 \-XX:G1HeapRegionSize=\fIsize\fR
2696 .RS 4
2697 Sets the size of the regions into which the Java heap is subdivided when using the garbage\-first (G1) collector\&. The value can be between 1 MB and 32 MB\&. The default region size is determined ergonomically based on the heap size\&.
2698 .sp
2699 The following example shows how to set the size of the subdivisions to 16 MB:
2700 .sp
2701 .if n \{\
2702 .RS 4
2703 .\}
2704 .nf
2705 \fB\-XX:G1HeapRegionSize=16m\fR
2706  
2707 .fi
2708 .if n \{\
2709 .RE
2710 .\}
2711 .RE
2712 .PP
2713 \-XX:+G1PrintHeapRegions
2714 .RS 4
2715 Enables the printing of information about which regions are allocated and which are reclaimed by the G1 collector\&. By default, this option is disabled\&.
2716 .RE
2717 .PP
2718 \-XX:G1ReservePercent=\fIpercent\fR
2719 .RS 4
2720 Sets the percentage of the heap (0 to 50) that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector\&. By default, this option is set to 10%\&.
2721 .sp
2722 The following example shows how to set the reserved heap to 20%:
2723 .sp
2724 .if n \{\
2725 .RS 4
2726 .\}
2727 .nf
2728 \fB\-XX:G1ReservePercent=20\fR
2729  
2730 .fi
2731 .if n \{\
2732 .RE
2733 .\}
2734 .RE
2735 .PP
2736 \-XX:InitialHeapSize=\fIsize\fR
2737 .RS 4
2738 Sets the initial size (in bytes) of the memory allocation pool\&. This value must be either 0, or a multiple of 1024 and greater than 1 MB\&. Append the letter
2739 \fBk\fR
2740 or
2741 \fBK\fR
2742 to indicate kilobytes,
2743 \fBm\fR
2744 or
2745 \fBM\fR
2746 to indicate megabytes,
2747 \fBg\fR
2748 or
2749 \fBG\fR
2750 to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. See the section "Ergonomics" in
2751 \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR
2752 at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
2753 .sp
2754 The following examples show how to set the size of allocated memory to 6 MB using various units:
2755 .sp
2756 .if n \{\
2757 .RS 4
2758 .\}
2759 .nf
2760 \fB\-XX:InitialHeapSize=6291456\fR
2761 \fB\-XX:InitialHeapSize=6144k\fR
2762 \fB\-XX:InitialHeapSize=6m\fR
2763  
2764 .fi
2765 .if n \{\
2766 .RE
2767 .\}
2768 If you set this option to 0, then the initial size will be set as the sum of the sizes allocated for the old generation and the young generation\&. The size of the heap for the young generation can be set using the
2769 \fB\-XX:NewSize\fR
2770 option\&.
2771 .RE
2772 .PP
2773 \-XX:InitialSurvivorRatio=\fIratio\fR
2774 .RS 4
2775 Sets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the
2776 \fB\-XX:+UseParallelGC\fR
2777 and/or \-\fBXX:+UseParallelOldGC\fR
2778 options)\&. Adaptive sizing is enabled by default with the throughput garbage collector by using the
2779 \fB\-XX:+UseParallelGC\fR
2780 and
2781 \fB\-XX:+UseParallelOldGC\fR
2782 options, and survivor space is resized according to the application behavior, starting with the initial value\&. If adaptive sizing is disabled (using the
2783 \fB\-XX:\-UseAdaptiveSizePolicy\fR
2784 option), then the
2785 \fB\-XX:SurvivorRatio\fR
2786 option should be used to set the size of the survivor space for the entire execution of the application\&.
2787 .sp
2788 The following formula can be used to calculate the initial size of survivor space (S) based on the size of the young generation (Y), and the initial survivor space ratio (R):
2789 .sp
2790 .if n \{\
2791 .RS 4
2792 .\}
2793 .nf
2794 \fBS=Y/(R+2)\fR
2795  
2796 .fi
2797 .if n \{\
2798 .RE
2799 .\}
2800 The 2 in the equation denotes two survivor spaces\&. The larger the value specified as the initial survivor space ratio, the smaller the initial survivor space size\&.
2801 .sp
2802 By default, the initial survivor space ratio is set to 8\&. If the default value for the young generation space size is used (2 MB), the initial size of the survivor space will be 0\&.2 MB\&.
2803 .sp
2804 The following example shows how to set the initial survivor space ratio to 4:
2805 .sp
2806 .if n \{\
2807 .RS 4
2808 .\}
2809 .nf
2810 \fB\-XX:InitialSurvivorRatio=4\fR
2811  
2812 .fi
2813 .if n \{\
2814 .RE
2815 .\}
2816 .RE
2817 .PP
2818 \-XX:InitiatingHeapOccupancyPercent=\fIpercent\fR
2819 .RS 4
2820 Sets the percentage of the heap occupancy (0 to 100) at which to start a concurrent GC cycle\&. It is used by garbage collectors that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (for example, the G1 garbage collector)\&.
2821 .sp
2822 By default, the initiating value is set to 45%\&. A value of 0 implies nonstop GC cycles\&. The following example shows how to set the initiating heap occupancy to 75%:
2823 .sp
2824 .if n \{\
2825 .RS 4
2826 .\}
2827 .nf
2828 \fB\-XX:InitiatingHeapOccupancyPercent=75\fR
2829  
2830 .fi
2831 .if n \{\
2832 .RE
2833 .\}
2834 .RE
2835 .PP
2836 \-XX:MaxGCPauseMillis=\fItime\fR
2837 .RS 4
2838 Sets a target for the maximum GC pause time (in milliseconds)\&. This is a soft goal, and the JVM will make its best effort to achieve it\&. By default, there is no maximum pause time value\&.
2839 .sp
2840 The following example shows how to set the maximum target pause time to 500 ms:
2841 .sp
2842 .if n \{\
2843 .RS 4
2844 .\}
2845 .nf
2846 \fB\-XX:MaxGCPauseMillis=500\fR
2847  
2848 .fi
2849 .if n \{\
2850 .RE
2851 .\}
2852 .RE
2853 .PP
2854 \-XX:MaxHeapSize=\fIsize\fR
2855 .RS 4
2856 Sets the maximum size (in byes) of the memory allocation pool\&. This value must be a multiple of 1024 and greater than 2 MB\&. Append the letter
2857 \fBk\fR
2858 or
2859 \fBK\fR
2860 to indicate kilobytes,
2861 \fBm\fR
2862 or
2863 \fBM\fR
2864 to indicate megabytes,
2865 \fBg\fR
2866 or
2867 \fBG\fR
2868 to indicate gigabytes\&. The default value is chosen at runtime based on system configuration\&. For server deployments,
2869 \fB\-XX:InitialHeapSize\fR
2870 and
2871 \fB\-XX:MaxHeapSize\fR
2872 are often set to the same value\&. See the section "Ergonomics" in
2873 \fIJava SE HotSpot Virtual Machine Garbage Collection Tuning Guide\fR
2874 at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/vm/gctuning/index\&.html\&.
2875 .sp
2876 The following examples show how to set the maximum allowed size of allocated memory to 80 MB using various units:
2877 .sp
2878 .if n \{\
2879 .RS 4
2880 .\}
2881 .nf
2882 \fB\-XX:MaxHeapSize=83886080\fR
2883 \fB\-XX:MaxHeapSize=81920k\fR
2884 \fB\-XX:MaxHeapSize=80m\fR
2885  
2886 .fi
2887 .if n \{\
2888 .RE
2889 .\}
2890 On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus overhead amounts\&. On Oracle Solaris 2\&.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts\&.
2891 .sp
2892 The
2893 \fB\-XX:MaxHeapSize\fR
2894 option is equivalent to
2895 \fB\-Xmx\fR\&.
2896 .RE
2897 .PP
2898 \-XX:MaxHeapFreeRatio=\fIpercent\fR
2899 .RS 4
2900 Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space expands above this value, then the heap will be shrunk\&. By default, this value is set to 70%\&.
2901 .sp
2902 The following example shows how to set the maximum free heap ratio to 75%:
2903 .sp
2904 .if n \{\
2905 .RS 4
2906 .\}
2907 .nf
2908 \fB\-XX:MaxHeapFreeRatio=75\fR
2909  
2910 .fi
2911 .if n \{\
2912 .RE
2913 .\}
2914 .RE
2915 .PP
2916 \-XX:MaxMetaspaceSize=\fIsize\fR
2917 .RS 4
2918 Sets the maximum amount of native memory that can be allocated for class metadata\&. By default, the size is not limited\&. The amount of metadata for an application depends on the application itself, other running applications, and the amount of memory available on the system\&.
2919 .sp
2920 The following example shows how to set the maximum class metadata size to 256 MB:
2921 .sp
2922 .if n \{\
2923 .RS 4
2924 .\}
2925 .nf
2926 \fB\-XX:MaxMetaspaceSize=256m\fR
2927  
2928 .fi
2929 .if n \{\
2930 .RE
2931 .\}
2932 .RE
2933 .PP
2934 \-XX:MaxNewSize=\fIsize\fR
2935 .RS 4
2936 Sets the maximum size (in bytes) of the heap for the young generation (nursery)\&. The default value is set ergonomically\&.
2937 .RE
2938 .PP
2939 \-XX:MaxTenuringThreshold=\fIthreshold\fR
2940 .RS 4
2941 Sets the maximum tenuring threshold for use in adaptive GC sizing\&. The largest value is 15\&. The default value is 15 for the parallel (throughput) collector, and 6 for the CMS collector\&.
2942 .sp
2943 The following example shows how to set the maximum tenuring threshold to 10:
2944 .sp
2945 .if n \{\
2946 .RS 4
2947 .\}
2948 .nf
2949 \fB\-XX:MaxTenuringThreshold=10\fR
2950  
2951 .fi
2952 .if n \{\
2953 .RE
2954 .\}
2955 .RE
2956 .PP
2957 \-XX:MetaspaceSize=\fIsize\fR
2958 .RS 4
2959 Sets the size of the allocated class metadata space that will trigger a garbage collection the first time it is exceeded\&. This threshold for a garbage collection is increased or decreased depending on the amount of metadata used\&. The default size depends on the platform\&.
2960 .RE
2961 .PP
2962 \-XX:MinHeapFreeRatio=\fIpercent\fR
2963 .RS 4
2964 Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event\&. If free heap space falls below this value, then the heap will be expanded\&. By default, this value is set to 40%\&.
2965 .sp
2966 The following example shows how to set the minimum free heap ratio to 25%:
2967 .sp
2968 .if n \{\
2969 .RS 4
2970 .\}
2971 .nf
2972 \fB\-XX:MinHeapFreeRatio=25\fR
2973  
2974 .fi
2975 .if n \{\
2976 .RE
2977 .\}
2978 .RE
2979 .PP
2980 \-XX:NewRatio=\fIratio\fR
2981 .RS 4
2982 Sets the ratio between young and old generation sizes\&. By default, this option is set to 2\&. The following example shows how to set the young/old ratio to 1:
2983 .sp
2984 .if n \{\
2985 .RS 4
2986 .\}
2987 .nf
2988 \fB\-XX:NewRatio=1\fR
2989  
2990 .fi
2991 .if n \{\
2992 .RE
2993 .\}
2994 .RE
2995 .PP
2996 \-XX:NewSize=\fIsize\fR
2997 .RS 4
2998 Sets the initial size (in bytes) of the heap for the young generation (nursery)\&. Append the letter
2999 \fBk\fR
3000 or
3001 \fBK\fR
3002 to indicate kilobytes,
3003 \fBm\fR
3004 or
3005 \fBM\fR
3006 to indicate megabytes,
3007 \fBg\fR
3008 or
3009 \fBG\fR
3010 to indicate gigabytes\&.
3011 .sp
3012 The young generation region of the heap is used for new objects\&. GC is performed in this region more often than in other regions\&. If the size for the young generation is too low, then a large number of minor GCs will be performed\&. If the size is too high, then only full GCs will be performed, which can take a long time to complete\&. Oracle recommends that you keep the size for the young generation between a half and a quarter of the overall heap size\&.
3013 .sp
3014 The following examples show how to set the initial size of young generation to 256 MB using various units:
3015 .sp
3016 .if n \{\
3017 .RS 4
3018 .\}
3019 .nf
3020 \fB\-XX:NewSize=256m\fR
3021 \fB\-XX:NewSize=262144k\fR
3022 \fB\-XX:NewSize=268435456\fR
3023  
3024 .fi
3025 .if n \{\
3026 .RE
3027 .\}
3028 The
3029 \fB\-XX:NewSize\fR
3030 option is equivalent to
3031 \fB\-Xmn\fR\&.
3032 .RE
3033 .PP
3034 \-XX:ParallelGCThreads=\fIthreads\fR
3035 .RS 4
3036 Sets the number of threads used for parallel garbage collection in the young and old generations\&. The default value depends on the number of CPUs available to the JVM\&.
3037 .sp
3038 For example, to set the number of threads for parallel GC to 2, specify the following option:
3039 .sp
3040 .if n \{\
3041 .RS 4
3042 .\}
3043 .nf
3044 \fB\-XX:ParallelGCThreads=2\fR
3045  
3046 .fi
3047 .if n \{\
3048 .RE
3049 .\}
3050 .RE
3051 .PP
3052 \-XX:+ParallelRefProcEnabled
3053 .RS 4
3054 Enables parallel reference processing\&. By default, this option is disabled\&.
3055 .RE
3056 .PP
3057 \-XX:+PrintAdaptiveSizePolicy
3058 .RS 4
3059 Enables printing of information about adaptive generation sizing\&. By default, this option is disabled\&.
3060 .RE
3061 .PP
3062 \-XX:+PrintGC
3063 .RS 4
3064 Enables printing of messages at every GC\&. By default, this option is disabled\&.
3065 .RE
3066 .PP
3067 \-XX:+PrintGCApplicationConcurrentTime
3068 .RS 4
3069 Enables printing of how much time elapsed since the last pause (for example, a GC pause)\&. By default, this option is disabled\&.
3070 .RE
3071 .PP
3072 \-XX:+PrintGCApplicationStoppedTime
3073 .RS 4
3074 Enables printing of how much time the pause (for example, a GC pause) lasted\&. By default, this option is disabled\&.
3075 .RE
3076 .PP
3077 \-XX:+PrintGCDateStamps
3078 .RS 4
3079 Enables printing of a date stamp at every GC\&. By default, this option is disabled\&.
3080 .RE
3081 .PP
3082 \-XX:+PrintGCDetails
3083 .RS 4
3084 Enables printing of detailed messages at every GC\&. By default, this option is disabled\&.
3085 .RE
3086 .PP
3087 \-XX:+PrintGCTaskTimeStamps
3088 .RS 4
3089 Enables printing of time stamps for every individual GC worker thread task\&. By default, this option is disabled\&.
3090 .RE
3091 .PP
3092 \-XX:+PrintGCTimeStamps
3093 .RS 4
3094 Enables printing of time stamps at every GC\&. By default, this option is disabled\&.
3095 .RE
3096 .PP
3097 \-XX:+PrintStringDeduplicationStatistics
3098 .RS 4
3099 Prints detailed deduplication statistics\&. By default, this option is disabled\&. See the
3100 \fB\-XX:+UseStringDeduplication\fR
3101 option\&.
3102 .RE
3103 .PP
3104 \-XX:+PrintTenuringDistribution
3105 .RS 4
3106 Enables printing of tenuring age information\&. The following is an example of the output:
3107 .sp
3108 .if n \{\
3109 .RS 4
3110 .\}
3111 .nf
3112 \fBDesired survivor size 48286924 bytes, new threshold 10 (max 10)\fR
3113 \fB\- age 1: 28992024 bytes, 28992024 total\fR
3114 \fB\- age 2: 1366864 bytes, 30358888 total\fR
3115 \fB\- age 3: 1425912 bytes, 31784800 total\fR
3116 \fB\&.\&.\&.\fR
3117  
3118 .fi
3119 .if n \{\
3120 .RE
3121 .\}
3122 Age 1 objects are the youngest survivors (they were created after the previous scavenge, survived the latest scavenge, and moved from eden to survivor space)\&. Age 2 objects have survived two scavenges (during the second scavenge they were copied from one survivor space to the next)\&. And so on\&.
3123 .sp
3124 In the preceding example, 28 992 024 bytes survived one scavenge and were copied from eden to survivor space, 1 366 864 bytes are occupied by age 2 objects, etc\&. The third value in each row is the cumulative size of objects of age n or less\&.
3125 .sp
3126 By default, this option is disabled\&.
3127 .RE
3128 .PP
3129 \-XX:+ScavengeBeforeFullGC
3130 .RS 4
3131 Enables GC of the young generation before each full GC\&. This option is enabled by default\&. Oracle recommends that you
3132 \fIdo not\fR
3133 disable it, because scavenging the young generation before a full GC can reduce the number of objects reachable from the old generation space into the young generation space\&. To disable GC of the young generation before each full GC, specify
3134 \fB\-XX:\-ScavengeBeforeFullGC\fR\&.
3135 .RE
3136 .PP
3137 \-XX:SoftRefLRUPolicyMSPerMB=\fItime\fR
3138 .RS 4
3139 Sets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced\&. The default value is one second of lifetime per free megabyte in the heap\&. The
3140 \fB\-XX:SoftRefLRUPolicyMSPerMB\fR
3141 option accepts integer values representing milliseconds per one megabyte of the current heap size (for Java HotSpot Client VM) or the maximum possible heap size (for Java HotSpot Server VM)\&. This difference means that the Client VM tends to flush soft references rather than grow the heap, whereas the Server VM tends to grow the heap rather than flush soft references\&. In the latter case, the value of the
3142 \fB\-Xmx\fR
3143 option has a significant effect on how quickly soft references are garbage collected\&.
3144 .sp
3145 The following example shows how to set the value to 2\&.5 seconds:
3146 .sp
3147 .if n \{\
3148 .RS 4
3149 .\}
3150 .nf
3151 \fB\-XX:SoftRefLRUPolicyMSPerMB=2500\fR
3152  
3153 .fi
3154 .if n \{\
3155 .RE
3156 .\}
3157 .RE
3158 .PP
3159 \-XX:StringDeduplicationAgeThreshold=\fIthreshold\fR
3160 .RS 4
3161 \fBString\fR
3162 objects reaching the specified age are considered candidates for deduplication\&. An object\*(Aqs age is a measure of how many times it has survived garbage collection\&. This is sometimes referred to as tenuring; see the
3163 \fB\-XX:+PrintTenuringDistribution\fR
3164 option\&. Note that
3165 \fBString\fR
3166 objects that are promoted to an old heap region before this age has been reached are always considered candidates for deduplication\&. The default value for this option is
3167 \fB3\fR\&. See the
3168 \fB\-XX:+UseStringDeduplication\fR
3169 option\&.
3170 .RE
3171 .PP
3172 \-XX:SurvivorRatio=\fIratio\fR
3173 .RS 4
3174 Sets the ratio between eden space size and survivor space size\&. By default, this option is set to 8\&. The following example shows how to set the eden/survivor space ratio to 4:
3175 .sp
3176 .if n \{\
3177 .RS 4
3178 .\}
3179 .nf
3180 \fB\-XX:SurvivorRatio=4\fR
3181  
3182 .fi
3183 .if n \{\
3184 .RE
3185 .\}
3186 .RE
3187 .PP
3188 \-XX:TargetSurvivorRatio=\fIpercent\fR
3189 .RS 4
3190 Sets the desired percentage of survivor space (0 to 100) used after young garbage collection\&. By default, this option is set to 50%\&.
3191 .sp
3192 The following example shows how to set the target survivor space ratio to 30%:
3193 .sp
3194 .if n \{\
3195 .RS 4
3196 .\}
3197 .nf
3198 \fB\-XX:TargetSurvivorRatio=30\fR
3199  
3200 .fi
3201 .if n \{\
3202 .RE
3203 .\}
3204 .RE
3205 .PP
3206 \-XX:TLABSize=\fIsize\fR
3207 .RS 4
3208 Sets the initial size (in bytes) of a thread\-local allocation buffer (TLAB)\&. Append the letter
3209 \fBk\fR
3210 or
3211 \fBK\fR
3212 to indicate kilobytes,
3213 \fBm\fR
3214 or
3215 \fBM\fR
3216 to indicate megabytes,
3217 \fBg\fR
3218 or
3219 \fBG\fR
3220 to indicate gigabytes\&. If this option is set to 0, then the JVM chooses the initial size automatically\&.
3221 .sp
3222 The following example shows how to set the initial TLAB size to 512 KB:
3223 .sp
3224 .if n \{\
3225 .RS 4
3226 .\}
3227 .nf
3228 \fB\-XX:TLABSize=512k\fR
3229  
3230 .fi
3231 .if n \{\
3232 .RE
3233 .\}
3234 .RE
3235 .PP
3236 \-XX:+UseAdaptiveSizePolicy
3237 .RS 4
3238 Enables the use of adaptive generation sizing\&. This option is enabled by default\&. To disable adaptive generation sizing, specify
3239 \fB\-XX:\-UseAdaptiveSizePolicy\fR
3240 and set the size of the memory allocation pool explicitly (see the
3241 \fB\-XX:SurvivorRatio\fR
3242 option)\&.
3243 .RE
3244 .PP
3245 \-XX:+UseCMSInitiatingOccupancyOnly
3246 .RS 4
3247 Enables the use of the occupancy value as the only criterion for initiating the CMS collector\&. By default, this option is disabled and other criteria may be used\&.
3248 .RE
3249 .PP
3250 \-XX:+UseConcMarkSweepGC
3251 .RS 4
3252 Enables the use of the CMS garbage collector for the old generation\&. Oracle recommends that you use the CMS garbage collector when application latency requirements cannot be met by the throughput (\fB\-XX:+UseParallelGC\fR) garbage collector\&. The G1 garbage collector (\fB\-XX:+UseG1GC\fR) is another alternative\&.
3253 .sp
3254 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. When this option is enabled, the
3255 \fB\-XX:+UseParNewGC\fR
3256 option is automatically set and you should not disable it, because the following combination of options has been deprecated in JDK 8:
3257 \fB\-XX:+UseConcMarkSweepGC \-XX:\-UseParNewGC\fR\&.
3258 .RE
3259 .PP
3260 \-XX:+UseG1GC
3261 .RS 4
3262 Enables the use of the garbage\-first (G1) garbage collector\&. It is a server\-style garbage collector, targeted for multiprocessor machines with a large amount of RAM\&. It meets GC pause time goals with high probability, while maintaining good throughput\&. The G1 collector is recommended for applications requiring large heaps (sizes of around 6 GB or larger) with limited GC latency requirements (stable and predictable pause time below 0\&.5 seconds)\&.
3263 .sp
3264 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
3265 .RE
3266 .PP
3267 \-XX:+UseGCOverheadLimit
3268 .RS 4
3269 Enables the use of a policy that limits the proportion of time spent by the JVM on GC before an
3270 \fBOutOfMemoryError\fR
3271 exception is thrown\&. This option is enabled, by default and the parallel GC will throw an
3272 \fBOutOfMemoryError\fR
3273 if more than 98% of the total time is spent on garbage collection and less than 2% of the heap is recovered\&. When the heap is small, this feature can be used to prevent applications from running for long periods of time with little or no progress\&. To disable this option, specify
3274 \fB\-XX:\-UseGCOverheadLimit\fR\&.
3275 .RE
3276 .PP
3277 \-XX:+UseNUMA
3278 .RS 4
3279 Enables performance optimization of an application on a machine with nonuniform memory architecture (NUMA) by increasing the application\*(Aqs use of lower latency memory\&. By default, this option is disabled and no optimization for NUMA is made\&. The option is only available when the parallel garbage collector is used (\fB\-XX:+UseParallelGC\fR)\&.
3280 .RE
3281 .PP
3282 \-XX:+UseParallelGC
3283 .RS 4
3284 Enables the use of the parallel scavenge garbage collector (also known as the throughput collector) to improve the performance of your application by leveraging multiple processors\&.
3285 .sp
3286 By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&. If it is enabled, then the
3287 \fB\-XX:+UseParallelOldGC\fR
3288 option is automatically enabled, unless you explicitly disable it\&.
3289 .RE
3290 .PP
3291 \-XX:+UseParallelOldGC
3292 .RS 4
3293 Enables the use of the parallel garbage collector for full GCs\&. By default, this option is disabled\&. Enabling it automatically enables the
3294 \fB\-XX:+UseParallelGC\fR
3295 option\&.
3296 .RE
3297 .PP
3298 \-XX:+UseParNewGC
3299 .RS 4
3300 Enables the use of parallel threads for collection in the young generation\&. By default, this option is disabled\&. It is automatically enabled when you set the
3301 \fB\-XX:+UseConcMarkSweepGC\fR
3302 option\&. Using the
3303 \fB\-XX:+UseParNewGC\fR
3304 option without the
3305 \fB\-XX:+UseConcMarkSweepGC\fR
3306 option was deprecated in JDK 8\&.
3307 .RE
3308 .PP
3309 \-XX:+UseSerialGC
3310 .RS 4
3311 Enables the use of the serial garbage collector\&. This is generally the best choice for small and simple applications that do not require any special functionality from garbage collection\&. By default, this option is disabled and the collector is chosen automatically based on the configuration of the machine and type of the JVM\&.
3312 .RE
3313 .PP
3314 \-XX:+UseSHM
3315 .RS 4
3316 On Linux, enables the JVM to use shared memory to setup large pages\&.
3317 .sp
3318 For more information, see "Large Pages"\&.
3319 .RE
3320 .PP
3321 \-XX:+UseStringDeduplication
3322 .RS 4
3323 Enables string deduplication\&. By default, this option is disabled\&. To use this option, you must enable the garbage\-first (G1) garbage collector\&. See the
3324 \fB\-XX:+UseG1GC\fR
3325 option\&.
3326 .sp
3327 \fIString deduplication\fR
3328 reduces the memory footprint of
3329 \fBString\fR
3330 objects on the Java heap by taking advantage of the fact that many
3331 \fBString\fR
3332 objects are identical\&. Instead of each
3333 \fBString\fR
3334 object pointing to its own character array, identical
3335 \fBString\fR
3336 objects can point to and share the same character array\&.
3337 .RE
3338 .PP
3339 \-XX:+UseTLAB
3340 .RS 4
3341 Enables the use of thread\-local allocation blocks (TLABs) in the young generation space\&. This option is enabled by default\&. To disable the use of TLABs, specify
3342 \fB\-XX:\-UseTLAB\fR\&.
3343 .RE
3344 .SS "Deprecated and Removed Options"
3345 .PP
3346 These options were included in the previous release, but have since been considered unnecessary\&.
3347 .PP
3348 \-Xincgc
3349 .RS 4
3350 Enables incremental garbage collection\&. This option was deprecated in JDK 8 with no replacement\&.
3351 .RE
3352 .PP
3353 \-Xrun\fIlibname\fR
3354 .RS 4
3355 Loads the specified debugging/profiling library\&. This option was superseded by the
3356 \fB\-agentlib\fR
3357 option\&.
3358 .RE
3359 .PP
3360 \-XX:CMSIncrementalDutyCycle=\fIpercent\fR
3361 .RS 4
3362 Sets the percentage of time (0 to 100) between minor collections that the concurrent collector is allowed to run\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3363 \fB\-XX:+CMSIncrementalMode\fR
3364 option\&.
3365 .RE
3366 .PP
3367 \-XX:CMSIncrementalDutyCycleMin=\fIpercent\fR
3368 .RS 4
3369 Sets the percentage of time (0 to 100) between minor collections that is the lower bound for the duty cycle when
3370 \fB\-XX:+CMSIncrementalPacing\fR
3371 is enabled\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3372 \fB\-XX:+CMSIncrementalMode\fR
3373 option\&.
3374 .RE
3375 .PP
3376 \-XX:+CMSIncrementalMode
3377 .RS 4
3378 Enables the incremental mode for the CMS collector\&. This option was deprecated in JDK 8 with no replacement, along with other options that start with
3379 \fBCMSIncremental\fR\&.
3380 .RE
3381 .PP
3382 \-XX:CMSIncrementalOffset=\fIpercent\fR
3383 .RS 4
3384 Sets the percentage of time (0 to 100) by which the incremental mode duty cycle is shifted to the right within the period between minor collections\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3385 \fB\-XX:+CMSIncrementalMode\fR
3386 option\&.
3387 .RE
3388 .PP
3389 \-XX:+CMSIncrementalPacing
3390 .RS 4
3391 Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3392 \fB\-XX:+CMSIncrementalMode\fR
3393 option\&.
3394 .RE
3395 .PP
3396 \-XX:CMSIncrementalSafetyFactor=\fIpercent\fR
3397 .RS 4
3398 Sets the percentage of time (0 to 100) used to add conservatism when computing the duty cycle\&. This option was deprecated in JDK 8 with no replacement, following the deprecation of the
3399 \fB\-XX:+CMSIncrementalMode\fR
3400 option\&.
3401 .RE
3402 .PP
3403 \-XX:CMSInitiatingPermOccupancyFraction=\fIpercent\fR
3404 .RS 4
3405 Sets the percentage of the permanent generation occupancy (0 to 100) at which to start a GC\&. This option was deprecated in JDK 8 with no replacement\&.
3406 .RE
3407 .PP
3408 \-XX:MaxPermSize=\fIsize\fR
3409 .RS 4
3410 Sets the maximum permanent generation space size (in bytes)\&. This option was deprecated in JDK 8, and superseded by the
3411 \fB\-XX:MaxMetaspaceSize\fR
3412 option\&.
3413 .RE
3414 .PP
3415 \-XX:PermSize=\fIsize\fR
3416 .RS 4
3417 Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded\&. This option was deprecated un JDK 8, and superseded by the
3418 \fB\-XX:MetaspaceSize\fR
3419 option\&.
3420 .RE
3421 .PP
3422 \-XX:+UseSplitVerifier
3423 .RS 4
3424 Enables splitting of the verification process\&. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime)\&. This option was deprecated in JDK 8, and verification is now split by default without a way to disable it\&.
3425 .RE
3426 .PP
3427 \-XX:+UseStringCache
3428 .RS 4
3429 Enables caching of commonly allocated strings\&. This option was removed from JDK 8 with no replacement\&.
3430 .RE
3431 .SH "PERFORMANCE TUNING EXAMPLES"
3432 .PP
3433 The following examples show how to use experimental tuning flags to either optimize throughput or to provide lower response time\&.
3434 .PP
3435 \fBExample 1 \fRTuning for Higher Throughput
3436 .RS 4
3437 .sp
3438 .if n \{\
3439 .RS 4
3440 .\}
3441 .nf
3442 \fBjava \-d64 \-server \-XX:+UseLargePages \-Xmn10g  \-Xms26g \-Xmx26g\fR
3443  
3444 .fi
3445 .if n \{\
3446 .RE
3447 .\}
3448 .RE
3449 .PP
3450 \fBExample 2 \fRTuning for Lower Response Time
3451 .RS 4
3452 .sp
3453 .if n \{\
3454 .RS 4
3455 .\}
3456 .nf
3457 \fBjava \-d64 \-XX:+UseG1GC \-Xms26g Xmx26g \-XX:MaxGCPauseMillis=500 \-XX:+PrintGCTimeStamp\fR
3458  
3459 .fi
3460 .if n \{\
3461 .RE
3462 .\}
3463 .RE
3464 .SH "LARGE PAGES"
3465 .PP
3466 Also known as huge pages, large pages are memory pages that are significantly larger than the standard memory page size (which varies depending on the processor and operating system)\&. Large pages optimize processor Translation\-Lookaside Buffers\&.
3467 .PP
3468 A Translation\-Lookaside Buffer (TLB) is a page translation cache that holds the most\-recently used virtual\-to\-physical address translations\&. TLB is a scarce system resource\&. A TLB miss can be costly as the processor must then read from the hierarchical page table, which may require multiple memory accesses\&. By using a larger memory page size, a single TLB entry can represent a larger memory range\&. There will be less pressure on TLB, and memory\-intensive applications may have better performance\&.
3469 .PP
3470 However, large pages page memory can negatively affect system performance\&. For example, when a large mount of memory is pinned by an application, it may create a shortage of regular memory and cause excessive paging in other applications and slow down the entire system\&. Also, a system that has been up for a long time could produce excessive fragmentation, which could make it impossible to reserve enough large page memory\&. When this happens, either the OS or JVM reverts to using regular pages\&.
3471 .SS "Large Pages Support"
3472 .PP
3473 Solaris and Linux support large pages\&.
3474 .sp
3475 .it 1 an-trap
3476 .nr an-no-space-flag 1
3477 .nr an-break-flag 1
3478 .br
3479 .ps +1
3480 \fBSolaris\fR
3481 .RS 4
3482 .PP
3483 Solaris 9 and later include Multiple Page Size Support (MPSS); no additional configuration is necessary\&. See http://www\&.oracle\&.com/technetwork/server\-storage/solaris10/overview/solaris9\-features\-scalability\-135663\&.html\&.
3484 .RE
3485 .sp
3486 .it 1 an-trap
3487 .nr an-no-space-flag 1
3488 .nr an-break-flag 1
3489 .br
3490 .ps +1
3491 \fBLinux\fR
3492 .RS 4
3493 .PP
3494 The 2\&.6 kernel supports large pages\&. Some vendors have backported the code to their 2\&.4\-based releases\&. To check if your system can support large page memory, try the following:
3495 .sp
3496 .if n \{\
3497 .RS 4
3498 .\}
3499 .nf
3500 \fB# cat /proc/meminfo | grep Huge\fR
3501 \fBHugePages_Total: 0\fR
3502 \fBHugePages_Free: 0\fR
3503 \fBHugepagesize: 2048 kB\fR
3504  
3505 .fi
3506 .if n \{\
3507 .RE
3508 .\}
3509 .PP
3510 If the output shows the three "Huge" variables, then your system can support large page memory but it needs to be configured\&. If the command prints nothing, then your system does not support large pages\&. To configure the system to use large page memory, login as
3511 \fBroot\fR, and then follow these steps:
3512 .sp
3513 .RS 4
3514 .ie n \{\
3515 \h'-04' 1.\h'+01'\c
3516 .\}
3517 .el \{\
3518 .sp -1
3519 .IP "  1." 4.2
3520 .\}
3521 If you are using the option
3522 \fB\-XX:+UseSHM\fR
3523 (instead of
3524 \fB\-XX:+UseHugeTLBFS\fR), then increase the
3525 \fBSHMMAX\fR
3526 value\&. It must be larger than the Java heap size\&. On a system with 4 GB of physical RAM (or less), the following will make all the memory sharable:
3527 .sp
3528 .if n \{\
3529 .RS 4
3530 .\}
3531 .nf
3532 \fB# echo 4294967295 > /proc/sys/kernel/shmmax\fR
3533  
3534 .fi
3535 .if n \{\
3536 .RE
3537 .\}
3538 .RE
3539 .sp
3540 .RS 4
3541 .ie n \{\
3542 \h'-04' 2.\h'+01'\c
3543 .\}
3544 .el \{\
3545 .sp -1
3546 .IP "  2." 4.2
3547 .\}
3548 If you are using the option
3549 \fB\-XX:+UseSHM\fR
3550 or
3551 \fB\-XX:+UseHugeTLBFS\fR, then specify the number of large pages\&. In the following example, 3 GB of a 4 GB system are reserved for large pages (assuming a large page size of 2048kB, then 3 GB = 3 * 1024 MB = 3072 MB = 3072 * 1024 kB = 3145728 kB and 3145728 kB / 2048 kB = 1536):
3552 .sp
3553 .if n \{\
3554 .RS 4
3555 .\}
3556 .nf
3557 \fB# echo 1536 > /proc/sys/vm/nr_hugepages\fR
3558  
3559 .fi
3560 .if n \{\
3561 .RE
3562 .\}
3563 .RE
3564 .if n \{\
3565 .sp
3566 .\}
3567 .RS 4
3568 .it 1 an-trap
3569 .nr an-no-space-flag 1
3570 .nr an-break-flag 1
3571 .br
3572 .ps +1
3573 \fBNote\fR
3574 .ps -1
3575 .br
3576 .TS
3577 allbox tab(:);
3578 l.
3579 T{
3580 .sp
3581 .RS 4
3582 .ie n \{\
3583 \h'-04'\(bu\h'+03'\c
3584 .\}
3585 .el \{\
3586 .sp -1
3587 .IP \(bu 2.3
3588 .\}
3589 Note that the values contained in
3590 \fB/proc\fR
3591 will reset after you reboot your system, so may want to set them in an initialization script (for example,
3592 \fBrc\&.local\fR
3593 or
3594 \fBsysctl\&.conf\fR)\&.
3595 .RE
3596 .sp
3597 .RS 4
3598 .ie n \{\
3599 \h'-04'\(bu\h'+03'\c
3600 .\}
3601 .el \{\
3602 .sp -1
3603 .IP \(bu 2.3
3604 .\}
3605 If you configure (or resize) the OS kernel parameters
3606 \fB/proc/sys/kernel/shmmax\fR
3607 or
3608 \fB/proc/sys/vm/nr_hugepages\fR, Java processes may allocate large pages for areas in addition to the Java heap\&. These steps can allocate large pages for the following areas:
3609 .sp
3610 .RS 4
3611 .ie n \{\
3612 \h'-04'\(bu\h'+03'\c
3613 .\}
3614 .el \{\
3615 .sp -1
3616 .IP \(bu 2.3
3617 .\}
3618 Java heap
3619 .RE
3620 .sp
3621 .RS 4
3622 .ie n \{\
3623 \h'-04'\(bu\h'+03'\c
3624 .\}
3625 .el \{\
3626 .sp -1
3627 .IP \(bu 2.3
3628 .\}
3629 Code cache
3630 .RE
3631 .sp
3632 .RS 4
3633 .ie n \{\
3634 \h'-04'\(bu\h'+03'\c
3635 .\}
3636 .el \{\
3637 .sp -1
3638 .IP \(bu 2.3
3639 .\}
3640 The marking bitmap data structure for the parallel GC
3641 .RE
3642 .sp
3643 Consequently, if you configure the
3644 \fBnr_hugepages\fR
3645 parameter to the size of the Java heap, then the JVM can fail in allocating the code cache areas on large pages because these areas are quite large in size\&.
3646 .RE
3647 T}
3648 .TE
3649 .sp 1
3650 .sp .5v
3651 .RE
3652 .RE
3653 .SH "EXIT STATUS"
3654 .PP
3655 The following exit values are typically returned by the launcher when the launcher is called with the wrong arguments, serious errors, or exceptions thrown by the JVM\&. However, a Java application may choose to return any value by using the API call
3656 \fBSystem\&.exit(exitValue)\fR\&. The values are:
3657 .sp
3658 .RS 4
3659 .ie n \{\
3660 \h'-04'\(bu\h'+03'\c
3661 .\}
3662 .el \{\
3663 .sp -1
3664 .IP \(bu 2.3
3665 .\}
3666 \fB0\fR: Successful completion
3667 .RE
3668 .sp
3669 .RS 4
3670 .ie n \{\
3671 \h'-04'\(bu\h'+03'\c
3672 .\}
3673 .el \{\
3674 .sp -1
3675 .IP \(bu 2.3
3676 .\}
3677 \fB>0\fR: An error occurred
3678 .RE
3679 .SH "SEE ALSO"
3680 .sp
3681 .RS 4
3682 .ie n \{\
3683 \h'-04'\(bu\h'+03'\c
3684 .\}
3685 .el \{\
3686 .sp -1
3687 .IP \(bu 2.3
3688 .\}
3689 javac(1)
3690 .RE
3691 .sp
3692 .RS 4
3693 .ie n \{\
3694 \h'-04'\(bu\h'+03'\c
3695 .\}
3696 .el \{\
3697 .sp -1
3698 .IP \(bu 2.3
3699 .\}
3700 jdb(1)
3701 .RE
3702 .sp
3703 .RS 4
3704 .ie n \{\
3705 \h'-04'\(bu\h'+03'\c
3706 .\}
3707 .el \{\
3708 .sp -1
3709 .IP \(bu 2.3
3710 .\}
3711 jar(1)
3712 .RE
3713 .sp
3714 .RS 4
3715 .ie n \{\
3716 \h'-04'\(bu\h'+03'\c
3717 .\}
3718 .el \{\
3719 .sp -1
3720 .IP \(bu 2.3
3721 .\}
3722 jstat(1)
3723 .RE
3724 .br
3725 'pl 8.5i
3726 'bp