JAVA(1) JDK Commands JAVA(1) (NAME) java - (SYNOPSIS) : java [options] mainclass [args ...] JAR: java [options] -jar jarfile [args ...] : java [options] -m module[/mainclass] [args ...] java [options] --module module[/mainclass] [args ...] : java [options] source-file [args ...] options : (space) . Overview of Java Options . mainclass . classname (main) . -jar jarfile JAR . jarfile JAR Main-Class:classname public static void main(String[] args) . -jar JAR (class path) . JAR jar . -m --module module[/mainclass] mainclass ( ) module . mainclass . Standard Options for Java . source-file . source-file . Using Source-File Mode to Launch Source-Code Programs . args ... : mainclass source-file -jar jarfile -m --module module/mainclass . (DESCRIPTION) java . (JVM) main() . public static String . : public static void main(String[] args) (source-file mode) java . Using Source-File Mode to Launch Source-Code Programs . : JDK_JAVA_OPTIONS java . Using the JDK_JAVA_OPTIONS Launcher Environment Variable . java (fully qualified name) . -jar JAR (resource) . Main-Class . JAR main() ..SS javaw : javaw java javaw . javaw . javaw . (USING SOURCE-FILE MODE TO LAUNCH SOURCE-CODE PROGRAMS) java (source-file mode) . java : o . (main class) . o --source version . .java --source . . --source (version) N . API . --source N API JDK N . : N . N . N Java SE (26) javac --source --release . .java --source java . --source "" Java . . . HelloWorld.java HelloWorld : java HelloWorld.java : javac -d --source-path HelloWorld.java java --class-path HelloWorld : o . : --class-path --module-path --add-exports --add-modules --limit-modules --patch-module --upgrade-module-path. --enable-preview JEP 12 . o -processor -Werror . o ( @) . VM @ . : o . : --class-path/-classpath/-cp --module-path/-p --add-exports --add-modules --limit-modules --patch-module --upgrade-module-path --enable-preview. o . HelloWorld.java hello HelloWorld.java somedir/hello/ . somedir . o (source-path) HelloWorld . o (Annotation processing) -proc:none . o --source --release . API . o --enable-preview --source N . Java N --release N . o module-info.java .java . module-info.java (unnamed module) . o (top-level) . o JLS 7.6 (type) .java . o (standard error) . : o . main . o (class loader) . (application class path) . o module-info.java .java . module-info.java --add-modules=ALL-DEFAULT . --add-module . o main . o ..PP JEP 458: Launch Multi-File Source-Code Programs [https://openjdk.org/jeps/458] . JDK_JAVA_OPTIONS (USING THE JDK_JAVA_OPTIONS LAUNCHER ENVIRONMENT VARIABLE) JDK_JAVA_OPTIONS () . JDK_JAVA_OPTIONS ( isspace()) . java . java . JDK_JAVA_OPTIONS . (') (") . . . @ . (*) JDK_JAVA_OPTIONS VM . JDK_JAVA_OPTIONS ( -jar) java ( -h) . . JDK_JAVA_OPTIONS stderr . : $ export JDK_JAVA_OPTIONS='-g @file1 -Dprop=value @file2 -Dws.prop="white spaces"' $ java -Xint @file3 : java -g @file1 -Dprop=value @file2 -Dws.prop="white spaces" -Xint @file3 JAVA (OVERVIEW OF JAVA OPTIONS) java : o Java: (JVM) . JRE (class path) (verbose) . o Java: Java HotSpot . JVM . -X . . Java HotSpot . Performance Tuning Examples . JVM . -XX . o Java: Java HotSpot VM . o JIT Java: (JIT) Java HotSpot VM . o Java: . o Java: (GC) Java HotSpot . (Boolean) . . -XX (-XX:+OptionName) (-XX:-OptionName) . (:) (=) ( ). k K (KB) m M (MB) g G (GB) . 8g 8192m 8388608k 8589934592 . . 0.25 . : o Java: --- . o Java: --- . o Java: --- ..SH " (STANDARD OPTIONS FOR JAVA)" JVM . : --name=value --name value . -agentlib:libname[=options] agent (native) . . -agentlib:foo JVM foo : o (POSIX-like): JVM libfoo.so LD_LIBRARY_PATH . o macOS: JVM libfoo.dylib DYLD_LIBRARY_PATH . o : JVM foo.dll PATH . Java Debug Wire Protocol (JDWP) 8000 JVM (suspend) : -agentlib:jdwp=transport=dt_socket,server=y,address=8000 -agentpath:pathname[=options] agent . -agentlib . --class-path classpath -classpath classpath -cp classpath JAR ZIP . - (;) (:) . classpath CLASSPATH . classpath (.) . (*) .jar .JAR . . mydir a.jar b.JAR mydir/* A.jar:b.JAR JAR . .jar . (*) jar . CLASSPATH . (wildcard) Java VM . System.getenv("CLASSPATH"). --disable-@files @filename . @-argfiles . --enable-preview (preview features) [https://docs.oracle.com/en/java/javase/12/language/index.html#JSLAN-GUID-5A82FE0E-0CA4-4F1F-B075-564874FE2823] . --enable-native-access module[,module...] (Native access) (Java runtime) . JVM . (restricted) [https://openjdk.org/jeps/454#Safety] native. . (illegal) . module ALL-UNNAMED . ---illegal-native-access=parameter : : . o allow: . o warn: allow . JDK . o deny: . IllegalCallerException . . JDK --illegal-native-access=deny --enable-native-access . --enable-final-field-mutation module[,module...] (Mutation) final reflection API . . final . final (illegal) . module ALL-UNNAMED . ---illegal-final-field-mutation=parameter final : : . o allow: final . o warn: allow final . JDK . o debug: allow final (stack trace) . o deny: final . final IllegalAccessException . . JDK --illegal-final-field-mutation=deny --enable-final-field-mutation . --finalization=value (finalization) JVM . "enabled" "disabled" . "enabled" . "disabled" (finalizer) ..TP --module-path modulepath... -p modulepath . . JAR (exploded-module). Windows - (;) (:) . --upgrade-module-path modulepath... (runtime image) . . JAR (exploded-module). Windows - (;) (:) . --add-modules module[,module...] . module ALL-DEFAULT ALL-SYSTEM ALL-MODULE-PATH . --list-modules . -d module_name --describe-module module_name . --dry-run (VM) (main) . --dry-run . --validate-modules . . -Dproperty=value . property . value . value ( -Dfoo="foo bar"). -disableassertions[:[packagename]...|:classname] -da[:[packagename]...|:classname] (assertions) . assertion . -disableassertions (-da) assertion . packagename ... assertion . ... assertion . classname assertion . -disableassertions (-da) ( ) . : . assertion . -disablesystemassertions assertion . assertion -enableassertions (-ea) . . MyClass assertion com.wombat.fruitbat ( ) com.wombat.fruitbat.Brickbat : java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass -disablesystemassertions -dsa assertion . -enableassertions[:[packagename]...|:classname] -ea[:[packagename]...|:classname] (assertions) . assertion . -enableassertions (-ea) assertion . packagename ... assertion . ... assertion . classname assertion . -enableassertions (-ea) ( ) . : . assertion . -enablesystemassertions assertion . assertion -disableassertions (-da) . . MyClass assertion com.wombat.fruitbat ( ) com.wombat.fruitbat.Brickbat : java -ea:com.wombat.fruitbat... -da:com.wombat.fruitbat.Brickbat MyClass -enablesystemassertions -esa assertion . -help -h -? . --help . -javaagent:jarpath[=options] (agent) Java . : java.lang.instrument. --show-version . -showversion . --show-module-resolution . -splash:imagepath (splash screen) imagepath . HiDPI . image.ext -splash . . splash.gif images : -splash:images/splash.gif SplashScreen API . -verbose:class . -verbose:gc (GC) . -verbose:jni native Java Native Interface (JNI) . -verbose:module . --version . -version ..TP -X . --help-extra . @argfile @ java . java .jar classpath . @argfile (shell expansion) . --disable-@files . . java : java @argfile @-argfiles java Command-Line Argument Files . (EXTRA OPTIONS FOR JAVA) java Java HotSpot . -Xbatch . JVM . -Xbatch . -XX:-BackgroundCompilation . -Xbootclasspath/a:directories|zip|JAR-files JAR ZIP (bootstrap class path) . (;) (:) . -Xcheck:jni (JNI) . (native) JVM : o (thread) JVM . o JNIEnv . o : o jfieldID jmethodID . : o o o . o . : o NULL o o UTF-8 o JNI o ReleaseXXX GetXXX : o JNI JNI . o (Lname;) . o NULL . o JNI Get/ReleasePrimitiveArrayCritical Get/ReleaseStringCritical. o JNI final . . -Xcomp JIT. (production) . -Xdebug . -Xdiag . -Xint . . (JIT) . -Xinternalversion JVM -version . -Xlog:option (JVM). Enable Logging with the JVM Unified Logging Framework . -Xmixed (hot methods) . . -Xint . -Xmn size ( ) (nursery) . k K m M g G . . GC . (minor GC) . (full GC) . G1 . : -Xmn256m -Xmn262144k -Xmn268435456 -Xmn -XX:NewSize -XX:MaxNewSize . -Xms size ( ) . . k K m M g G . : -Xms6291456 -Xms6144k -Xms6m (old generation) (young generation) . -Xmn -XX:NewSize . -XX:InitialHeapSize . -Xms -XX:InitialHeapSize . -Xmx size ( ) . . k K m M g G . . -Xms -Xmx . : -Xmx83886080 -Xmx81920k -Xmx80m -Xmx -XX:MaxHeapSize . -Xnoclassgc (GC) . GC . -Xnoclassgc (class objects) GC . (out-of-memory) . -Xrs JVM . (shutdown hooks) ( ) JVM . o (Non-Windows): o JVM . JVM SIGHUP SIGINT SIGTERM . o JVM SIGINT SIGTERM (signal handlers) JVM . -Xrs . -Xrs SIGINT SIGTERM SIGHUP SIGQUIT JVM . o (Windows): o JVM . JVM CTRL_C_EVENT CTRL_CLOSE_EVENT CTRL_LOGOFF_EVENT CTRL_SHUTDOWN_EVENT TRUE . o JVM (thread dumps) . JVM CTRL_BREAK_EVENT . o JVM ( ) CTRL_LOGOFF_EVENT . -Xrs . -Xrs JVM CTRL_C_EVENT CTRL_CLOSE_EVENT CTRL_LOGOFF_EVENT CTRL_SHUTDOWN_EVENT . -Xrs : o (Non-Windows): SIGQUIT . o (Windows): Ctrl + Break . System.exit() JVM . -Xshare:mode (CDS) . mode : auto (). on . : -Xshare:on . CDS ( VM JDK ) . . off . -XshowSettings . -XshowSettings:category . category : all (verbose) . locale (locale) . properties (system properties) . security . security : o security:all : o security:properties : o security:providers : o security:tls : TLS vm JVM . system : . -Xss size (thread stack) ( ) . k K m M g G . (page size) . () . : Linux/x64: 1024 KB o Linux/Aarch64: 2048 KB o macOS/x64: 1024 KB o macOS/Aarch64: 2048 KB o : . (thread stack) 1024 KB : -Xss1m -Xss1024k -Xss1048576 -XX:ThreadStackSize . --add-reads module=target-module(,target-module)* module target-module . target-module ALL-UNNAMED . --add-exports module/package=target-module(,target-module)* module package target-module (export) . target-module ALL-UNNAMED . --add-opens module/package=target-module(,target-module)* module package target-module (open) . --limit-modules module[,module...] . --patch-module module=file(;file)* JAR . --source version source-file . --sun-misc-unsafe-memory-access= value (API) sun.misc.Unsafe . value : allow . warn . . debug (stack trace) . deny UnsupportedOperationException . warn . MACOS (EXTRA OPTIONS FOR MACOS) macOS . -XstartOnFirstThread main() (AppKit) . -Xdock:name=application_name (dock) . -Xdock:icon=path_to_icon_file ..SH " (ADVANCED OPTIONS FOR JAVA)" java . -XX:+UnlockDiagnosticVMOptions JVM . . . Oracle . . -XX:+UnlockExperimentalVMOptions JVM . . (ADVANCED RUNTIME OPTIONS FOR JAVA) java Java HotSpot VM . -XX:ActiveProcessorCount=x (CPU) (thread pools) Garbage Collection ForkJoinPool (override) . . CPU docker . UseContainerSupport . -XX:-UseContainerSupport . -XX:AllocateHeapAt=path (memory mapping) (object heap) . HotSpot VM NV-DIMM . DRAM (atomic operations) DRAM . ( code heap metaspace ) DRAM . DRAM . (page cache) . ( -Xmx -Xms) (garbage collection) . -XX:-CompactStrings Compact Strings . . ISO-8859-1 / Latin-1 . . : UTF-16 . Compact Strings UTF-16 . Compact Strings : o o Java SE 8 Java SE 9 Compact Strings Compact Strings . -XX:ErrorFile=filename . hs_err_pidpid.log pid . ( %p ): -XX:ErrorFile=./hs_err_pid%p.log o (Non-Windows): /var/log/java/java_error.log : -XX:ErrorFile=/var/log/java/java_error.log o (Windows): C:/log/java/java_error.log : -XX:ErrorFile=C:/log/java/java_error.log . ( ) : o (Non-Windows): /tmp . o (Windows): TMP TEMP . -XX:+ExtensiveErrorReports ErrorFile . - / . . . -XX:FlightRecorderOptions=parameter=value () -XX:FlightRecorderOptions:parameter=value JFR . . parameter=value JFR : globalbuffersize=size . memorysize . memorysize . maxchunksize=size ( ) (recording) . (MB) m M (GB) g G . 12 MB . 1 MB . memorysize=size globalbuffersize numglobalbuffers . (MB) m M (GB) g G . 10 MB . numglobalbuffers . . memorysize ..TP old-object-queue-size=number-of-objects . 256 . preserve-repository={true|false} JVM . false . . repository=path ( ) . . retransform={true|false} JVMTI (retransform) . false (instrumentation) . . stackdepth=depth (stack traces). . . . threadbuffersize=size ( ) . . . -XX:LargePageSizeInBytes=size ( ) JVM . size . k K m M g G . 0 JVM . Large Pages . (GB) : -XX:LargePageSizeInBytes=1g -XX:MaxDirectMemorySize=size ( ) (direct-buffer) java.nio . k K m M g G . JVM NIO . NIO : -XX:MaxDirectMemorySize=1m -XX:MaxDirectMemorySize=1024k -XX:MaxDirectMemorySize=1048576 -XX:-MaxFDLimit (soft limit) (hard limit) . Windows . macOS . -XX:NativeMemoryTracking=mode (native memory) (JVM) . mode : off JVM . -XX:NativeMemoryTracking . summary JVM Java heap (thread) . detail JVM CallSite (committed) . -XX:TrimNativeHeapInterval=millis JVM (native heap) (trim) . . 0 () . . Linux (glibc) . -XX:ObjectAlignmentInBytes=alignment ( ) . . ( ) . (compressed pointers) Java heap . heap : 4GB * ObjectAlignmentInBytes : . Java heap . -XX:OnError=string . . o Windows: -XX:OnError gcore (core image) gdb (%p ): -XX:OnError="gcore %p;gdb -p %p" o Windows: -XX:OnError userdump.exe (crash dump) (%p ). userdump.exe PATH : -XX:OnError="userdump.exe %p" -XX:OnOutOfMemoryError=string OutOfMemoryError JVM . . -XX:OnError . OutOfMemoryError Java Heap OutOfMemoryError JVM ( ) ..TP -XX:+PrintCommandLineFlags JVM . JVM heap (garbage collector) . . -XX:+PreserveFramePointer RBP (-XX:-PreserveFramePointer) RBP (frame pointer) (-XX:+PreserveFramePointer) . ( Linux perf) (stack trace) . -XX:+PrintNMTStatistics (native memory tracking) JVM ( -XX:NativeMemoryTracking ) . . -XX:SharedArchiveFile=path (CDS) . Application Class Data Sharing . -XX:+VerifySharedSpaces JVM CDS CRC32 . CDS . CDS CDS . -XX:SharedArchiveConfigFile=shared_config_file . -XX:SharedClassListFile=file_name (CDS) . (/) (.) . java.lang.Object hello.Main : java/lang/Object hello/Main . (class paths) bootstrap . Application Class Data Sharing . -XX:+ShowCodeDetailsInExceptionMessages NullPointerException . NullPointerException JVM null (null-detail) . NullPointerException.getMessage() . . -XX:+ShowMessageBoxOnError JVM . JVM (debugger) . . -XX:StartFlightRecording:parameter=value JFR . JFR.start . -XX:StartFlightRecording:help . JFR parameter=value : delay=time . s m h d ( 10m ). 0 . disk={true|false} . . dumponexit={true|false} JVM (dump) . filename . (PID) hotspot-pid-47496-id-1-2018_01_25_19_10_41.jfr. . duration=time . s m h d ( 5h ). 0 . filename=path : o recording.jfr o /home/user/recordings/recording.jfr o c:\recordings\recording.jfr %p / %t PID JVM . PID . name=identifier . maxage=time . disk true . s m h d ( 30s ). 0s . maxsize=size ( ) . disk true . maxchunksize -XX:FlightRecorderOptions . m M g G . 0 . path-to-gc-roots={true|false} (GC roots) . . GC (memory leaks) . . settings profile (stack trace) . report-on-exit=identifier (view) (JVM) . report-on-exit . disk false . jfr help view . ..TP settings=path ( JFC) . default.jfc JAVA_HOME/lib/jfr . . profile.jfc . . . .jfc : option=value . JAVA_HOME/bin/jfr . event-setting=value . : #=. '+' . .jfc . .jfc . 20ms. Javadoc jdk.jfr . JFR -Xlog:jfr+startup=warning . -XX:ThreadStackSize=size (thread stack) ( ) . k -XX:ThreadStackSize=1k 1024*1024 . . : o Linux/x64: 1024 KB o Linux/Aarch64: 2048 KB o macOS/x64: 1024 KB o macOS/Aarch64: 2048 KB o Windows: : -XX:ThreadStackSize=1k -XX:ThreadStackSize=1024 -Xss . -XX:+UseCompactObjectHeaders (compact object headers) . . (heap) ( ) . . . -XX:-UseCompressedOops (compressed pointers) . . . . compressed oops compressed oops . JVM . . -XX:ObjectAlignmentInBytes . -XX:-UseContainerSupport : VM docker . . true . -XX:-UseContainerSupport . Unified Logging . -Xlog:os+container=trace . Unified Logging Enable Logging with the JVM Unified Logging Framework . -XX:+UseLargePages (large page memory) . . Large Pages . -XX:+UseTransparentHugePages : . . transparent huge pages . -XX:+AllowUserSignalHandlers : (signal handlers) . . -XX:VMOptionsFile=filename VM : java -XX:VMOptionsFile=/var/my_vm_options HelloWorld. -XX:UseBranchProtection=mode AArch64: (branch protection) . none VM . (native) . mode : none . . standard . pac-ret ROP . ( AArch64 8.3+) java (JIT) Java HotSpot VM . -XX:AllocateInstancePrefetchLines=lines (prefetch) . 1 : -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchDistance=size ( ) . . (thread) . (platform) . . k K m M g G . -1 . 1024 : -XX:AllocatePrefetchDistance=1024 -XX:AllocatePrefetchInstr=instruction . 0 3 . (platform) . 0 : -XX:AllocatePrefetchInstr=0 -XX:AllocatePrefetchLines=lines (cache lines) . (instance) 1 (array) 3 . 5 : -XX:AllocatePrefetchLines=5 -XX:AllocatePrefetchStepSize=size ( ) . k K m M g G . 16 : -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchStyle=style . style 0 3 : 0 . 1 . . 2 (TLAB) . 3 (cache line) . -XX:+BackgroundCompilation . . -XX:-BackgroundCompilation ( -Xbatch ). -XX:CICompilerCount=threads (threads) . CPU . 2 : -XX:CICompilerCount=2 -XX:+UseDynamicNumberOfCompilerThreads -XX:CICompilerCount. . -XX:CompileCommand=command,method[,option] command method . indexOf() String : -XX:CompileCommand=exclude,java/lang/String.indexOf (/) . (cut-and-paste) -XX:+PrintCompilation -XX:+LogCompilation : -XX:CompileCommand=exclude,java.lang.String::indexOf (signature) . . (shell) . indexOf(String) String : -XX:CompileCommand="exclude,java/lang/String.indexOf,(Ljava/lang/String;)I" (*) (wildcard) . indexOf() : -XX:CompileCommand=exclude,*.indexOf . -XX:CompileCommand : -XX:CompileCommand="exclude java/lang/String indexOf" -XX:CompileCommand JIT .hotspot_compiler . -XX:CompileCommandFile . -XX:CompileCommand (\n) . : break JVM (breakpoint) ..TP compileonly . -XX:CompileOnly . dontinline (inlining) . exclude . help -XX:CompileCommand . inline . log ( -XX:+LogCompilation) . . option JIT (option) . . BlockLayoutByFrequency append() StringBuffer : -XX:CompileCommand=option,java/lang/StringBuffer.append,BlockLayoutByFrequency . print . quiet . -XX:CompileCommand indexOf() String : CompilerOracle: exclude java/lang/String.indexOf -XX:CompileCommand=quiet -XX:CompileCommand . -XX:CompileCommandFile=filename JIT . .hotspot_compiler JIT . . toString() String : print java/lang/String toString JIT -XX:CompileCommand . -XX:CompilerDirectivesFile=file (directives) . Compiler Control : [https://docs.oracle.com/en/java/javase/12/vm/compiler-control1.html#GUID-94AD8194-786A-4F19-BFFF-278F8E237F3A]. -XX:CompilerDirectivesFile -XX:UnlockDiagnosticVMOptions JVM . -XX:+CompilerDirectivesPrint . -XX:+CompilerDirectivesPrint -XX:UnlockDiagnosticVMOptions JVM . -XX:CompileOnly=methods ( ) . . -XX:CompileOnly=method1,method2,...,methodN : -XX:CompileCommand=compileonly,method1 -XX:CompileCommand=compileonly,method2 ... -XX:CompileCommand=compileonly,methodN -XX:CompileThresholdScaling=scale . (tiered) (nontiered) . CompileThresholdScaling 0 Inf+ ( ) . CompileThresholdScaling 1.0 1.0 . CompileThresholdScaling 0 . -XX:+DoEscapeAnalysis (escape analysis) . . -XX:-DoEscapeAnalysis . -XX:InitialCodeCacheSize=size (code cache) ( ) . k K m M g G . . . : -XX:InitialCodeCacheSize=32k -XX:+Inline (method inlining) . . -XX:-Inline . -XX:InlineSmallCode=size ( ) . C2 . k K m M g G . . : -XX:InlineSmallCode=1000 -XX:+LogCompilation hotspot.log . -XX:LogFile . . -XX:+LogCompilation -XX:UnlockDiagnosticVMOptions JVM . (verbose) -XX:+PrintCompilation . -XX:FreqInlineSize=size ( ) (hot method) (inlining) . C2 . k K m M g G . (platform) . : -XX:FreqInlineSize=325 -XX:MaxInlineSize=size ( ) (cold method) . C2 . k K m M g G . : -XX:MaxInlineSize=35 -XX:C1MaxInlineSize=size ( ) . C1 . k K m M g G . : -XX:MaxInlineSize=35 -XX:MaxTrivialSize=size ( ) (trivial method) . C2 . k K m M g G . : -XX:MaxTrivialSize=6 -XX:C1MaxTrivialSize=size ( ) . C1 . k K m M g G . : -XX:MaxTrivialSize=6 -XX:MaxNodeLimit=nodes . . : -XX:MaxNodeLimit=100000 -XX:NonNMethodCodeHeapSize=size (nonmethod code) . . (code cache) . -XX:SegmentedCodeCache . -XX:NonProfiledCodeHeapSize=size . -XX:SegmentedCodeCache . -XX:+OptimizeStringConcat String . . String -XX:-OptimizeStringConcat . -XX:+PrintAssembly (native) hsdis-.so .dll . Windows hsdis-amd64.dll . . . -XX:+PrintAssembly -XX:UnlockDiagnosticVMOptions ( JVM ) . -XX:ProfiledCodeHeapSize=size . -XX:SegmentedCodeCache . -XX:+PrintCompilation JVM . . . -XX:+LogCompilation . -XX:+PrintInlining . . . -XX:+PrintInlining -XX:+UnlockDiagnosticVMOptions ( JVM ) . -XX:ReservedCodeCacheSize=size (code cache) JIT . k K m M g G . (tiered compilation) -XX:-TieredCompilation . . -XX:InitialCodeCacheSize . -XX:+SegmentedCodeCache . -XX:+SegmentedCodeCache . . (memory footprint) (fragmentation) iTLB (instruction translation lookaside buffer) (locality) . (-XX:+TieredCompilation) (-XX:ReservedCodeCacheSize) . -XX:StartAggressiveSweepingAt=percent (stack scanning) . ..TP -XX:-TieredCompilation (tiered compilation) . . -XX:UseSSE=version SSE . ( x86). -XX:UseAVX=version AVX . ( x86). -XX:+UseAES AES . . -XX:+UseAES UseAESIntrinsics . -XX:+UnlockDiagnosticVMOptions . -XX:+UseAESIntrinsics AES . -XX:+UseAESIntrinsics -XX:+UseAES . AES -XX:-UseAES -XX:-UseAESIntrinsics . AES : -XX:+UseAES -XX:+UseAESIntrinsics -XX:+UnlockDiagnosticVMOptions . -XX:+UseAESCTRIntrinsics -XX:+UseAESIntrinsics AES/CTR . -XX:+UseGHASHIntrinsics GHASH . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseChaCha20Intrinsics ChaCha20 . . ChaCha20 -XX:-UseChaCha20Intrinsics . -XX:+UnlockDiagnosticVMOptions . -XX:+UsePoly1305Intrinsics Poly1305 . . Poly1305 -XX:-UsePoly1305Intrinsics . -XX:+UnlockDiagnosticVMOptions . -XX:+UseBASE64Intrinsics BASE64 java.util.Base64 . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseAdler32Intrinsics Adler32 java.util.zip.Adler32 . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseCRC32Intrinsics CRC32 java.util.zip.CRC32 . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseCRC32CIntrinsics CRC32C java.util.zip.CRC32C . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseSHA SHA . UseSHA UseSHA1Intrinsics UseSHA256Intrinsics UseSHA512Intrinsics . UseSHA UseSHA*Intrinsics . sun.security.provider.Sun SHA . -XX:+UnlockDiagnosticVMOptions . SHA -XX:-UseSHA . SHA . : -XX:-UseSHA256Intrinsics. -XX:+UseSHA1Intrinsics SHA-1 . -XX:+UnlockDiagnosticVMOptions . -XX:+UseSHA256Intrinsics SHA-224 SHA-256 . -XX:+UnlockDiagnosticVMOptions . -XX:+UseSHA512Intrinsics SHA-384 SHA-512 . -XX:+UnlockDiagnosticVMOptions . -XX:+UseMathExactIntrinsics java.lang.Math.*Exact() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseMultiplyToLenIntrinsic BigInteger.multiplyToLen() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseSquareToLenIntrinsic BigInteger.squareToLen() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseMulAddIntrinsic BigInteger.mulAdd() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseMontgomeryMultiplyIntrinsic BigInteger.montgomeryMultiply() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseMontgomerySquareIntrinsic BigInteger.montgomerySquare() . . -XX:+UnlockDiagnosticVMOptions . -XX:+UseCMoveUnconditionally CMove ( ) . -XX:+UseCodeCacheFlushing (code cache) . . -XX:-UseCodeCacheFlushing . -XX:+UseCondCardMark . . ..TP -XX:+UseCountedLoopSafepoints (safepoint) (counted loops) . . -XX:LoopStripMiningIter=number_of_iterations strip mined . Strip mining . . . . -XX:LoopStripMiningIterShortLoop=number_of_iterations strip mining . . / -XX:LoopStripMiningIter . -XX:+UseFMA (intrinsics) FMA FMA ( Intel ARM64) . FMA java.lang.Math.fma(a, b, c) ( a * b + c ) . -XX:+UseSuperWord (scalar) superword . Superword (vectorization) . . superword -XX:-UseSuperWord . (ADVANCED SERVICEABILITY OPTIONS FOR JAVA) java . -XX:+DisableAttachMechanism JVM . jcmd jstack jmap jinfo . : jcmd jinfo jmap jstack JDK JDK . -XX:+DTraceAllocProbes macOS: dtrace . -XX:+DTraceMethodProbes macOS: dtrace . -XX:+DTraceMonitorProbes macOS: dtrace (monitor events) . -XX:+HeapDumpOnOutOfMemoryError (HPROF) java.lang.OutOfMemoryError JVM . -XX:HeapDumpPath . OutOfMemoryError . OutOfMemoryError OutOfMemoryError JVM ( ) . -XX:HeapDumpPath=path (HPROF) -XX:+HeapDumpOnOutOfMemoryError . java_pid.hprof . (%p ): -XX:HeapDumpPath=./java_pid%p.hprof o : /var/log/java/java_heapdump.hprof : -XX:HeapDumpPath=/var/log/java/java_heapdump.hprof o : C:/log/java/java_heapdump.log : -XX:HeapDumpPath=C:/log/java/java_heapdump.log -XX:LogFile=path (log) . hotspot.log . o : /var/log/java/hotspot.log : -XX:LogFile=/var/log/java/hotspot.log o : C:/log/java/hotspot.log : -XX:LogFile=C:/log/java/hotspot.log -XX:+PrintClassHistogram () : o : Control+\ (SIGQUIT) o : Control+C (SIGTERM) . jmap -histo jcmd pid GC.class_histogram pid . -XX:+PrintConcurrentLocks java.util.concurrent : o : Control+\ (SIGQUIT) o : Control+C (SIGTERM) . jstack -l jcmd pid Thread.print -l pid . -XX:+PrintFlagsRanges . Validate Java Virtual Machine Flag Arguments . -XX:+PerfDataSaveToFile (binary) jstat . hsperfdata_pid pid . jstat : jstat -class file:///path/hsperfdata_pid jstat -gc file:///path/hsperfdata_pid -XX:+UsePerfData perfdata . JVM . hsperfdata_userid . perfdata -XX:-UsePerfData . (ADVANCED GARBAGE COLLECTION OPTIONS FOR JAVA) java (GC) Java HotSpot VM . -XX:+AlwaysPreTouch VM (pre-touch) . . -XX:ConcGCThreads=threads . threads / . (CPUs) JVM . GC : -XX:ConcGCThreads=2 -XX:+DisableExplicitGC System.gc() . System.gc() . System.gc() JVM GC . -XX:+ExplicitGCInvokesConcurrent GC System.gc() . -XX:+UseG1GC . -XX:G1AdaptiveIHOPNumInitialSamples=number -XX:UseAdaptiveIHOP G1 -XX:InitiatingHeapOccupancyPercent . G1 -XX:InitiatingHeapOccupancyPercent . . -XX:G1HeapRegionSize=size G1 (Garbage-First) . . . : -XX:G1HeapRegionSize=16m -XX:G1HeapWastePercent=percent . Java HotSpot VM (mixed) . . -XX:G1MaxNewSizePercent=percent (young generation) . . . -XX:DefaultMaxNewGenPercent . -XX:G1MixedGCCountTarget=number G1MixedGCLIveThresholdPercent . . . -XX:G1MixedGCLiveThresholdPercent=percent . . . -XX:G1OldCSetRegionLiveThresholdPercent . -XX:G1NewSizePercent=percent . . . -XX:DefaultMinNewGenPercent . -XX:G1OldCSetRegionThresholdPercent=percent . . -XX:G1ReservePercent=percent ( ) (promotion failure) G1 . . . : -XX:G1ReservePercent=20 -XX:+G1UseAdaptiveIHOP . G1 -XX:G1AdaptiveIHOPNumInitialSamples -XX:InitiatingHeapOccupancyPercent . -XX:InitiatingHeapOccupancyPercent . . -XX:InitialHeapSize=size ( ) . . k K m M g G . . : -XX:InitialHeapSize=6291456 -XX:InitialHeapSize=6144k -XX:InitialHeapSize=6m . -XX:NewSize . -Xms . -Xms -XX:InitialHeapSize -Xms . -XX:InitialRAMPercentage=percent JVM (ergonomics heuristics) -XX:MaxRAM . : -XX:InitialRAMPercentage=5 -XX:InitialSurvivorRatio=ratio survivor (throughput garbage collector -XX:+UseParallelGC ) . (Adaptive sizing) -XX:+UseParallelGC survivor . ( -XX:-UseAdaptiveSizePolicy) -XX:SurvivorRatio survivor . survivor ( S) young generation ( Y) survivor ( R) : S=Y/(R+2) survivor . survivor survivor . survivor . ( ) survivor . survivor : -XX:InitialSurvivorRatio=4 -XX:InitiatingHeapOccupancyPercent=percent old generation ( ) (concurrent marking) G1 . . GC G1 . -XX:G1UseAdaptiveIHOP -XX:G1AdaptiveIHOPNumInitialSamples . : -XX:InitiatingHeapOccupancyPercent=75 -XX:MaxGCPauseMillis=time GC ( ) . (soft goal) JVM . G1 Parallel GC . G1 . : -XX:MaxGCPauseMillis=500 -XX:MaxHeapSize=size ( ) . . k K m M g G . . -XX:InitialHeapSize -XX:MaxHeapSize . : -XX:MaxHeapSize=83886080 -XX:MaxHeapSize=81920k -XX:MaxHeapSize=80m -XX:MaxHeapSize -Xmx . -XX:MaxHeapFreeRatio=percent ( ) GC . (shrink) . . MaxHeapFreeRatio ( ) MinHeapFreeRatio ( ) -XX:MaxHeapFreeRatio -XX:MinHeapFreeRatio . MaxHeapFreeRatio MinHeapFreeRatio . . -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:-ShrinkHeapInSteps . (dynamic footprint) (embedded) Performance Tuning Examples . -XX:MaxMetaspaceSize=size (native memory) (class metadata) . . . : -XX:MaxMetaspaceSize=256m -XX:MaxNewSize=size ( ) (nursery) . (ergonomically) . -XX:MaxRAMPercentage=percent JVM -XX:MaxRAM . . compressed oops compressed oops . compressed oops -XX:UseCompressedOops . : -XX:MaxRAMPercentage=75 -XX:MinRAMPercentage=percent JVM (small heaps) -XX:MaxRAM . . . : -XX:MinRAMPercentage=75 -XX:MaxTenuringThreshold=threshold (tenuring threshold) GC . 15 . (throughput) 15 . 10 : -XX:MaxTenuringThreshold=10 -XX:MetaspaceSize=size (garbage collection) . . . -XX:MinHeapFreeRatio=percent (0 100) GC . . 40% . MaxHeapFreeRatio ( 70%) MinHeapFreeRatio ( 40%) -XX:MaxHeapFreeRatio -XX:MinHeapFreeRatio . MaxHeapFreeRatio 10% MinHeapFreeRatio 5% . . -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:-ShrinkHeapInSteps . (embedded) Performance Tuning Examples . -XX:MinHeapSize=size ( ) . 0 1024 1 . k K m M g G . . 6 : -XX:MinHeapSize=6291456 -XX:MinHeapSize=6144k -XX:MinHeapSize=6m 0 . -XX:NewRatio=ratio (young) (old) . 2 . 1 : -XX:NewRatio=1 -XX:NewSize=size ( ) (nursery) . k K m M g G . . GC . minor GC . full GC . 25% 50% . 256 : -XX:NewSize=256m -XX:NewSize=262144k -XX:NewSize=268435456 -XX:NewSize -Xmn . -XX:ParallelGCThreads=threads stop-the-world (STW) . CPU JVM . G1 GC 2 : -XX:ParallelGCThreads=2 -XX:+PrintAdaptiveSizePolicy . . -XX:SoftRefLRUPolicyMSPerMB=time ( ) (softly reachable) . . -XX:SoftRefLRUPolicyMSPerMB ( Java HotSpot Client VM) ( Java HotSpot Server VM) . Client VM (soft references) Server VM . -Xmx . 2.5 : -XX:SoftRefLRUPolicyMSPerMB=2500 -XX:-ShrinkHeapInSteps -XX:MaxHeapFreeRatio . . . . . MaxHeapFreeRatio Performance Tuning Examples . -XX:StringDeduplicationAgeThreshold=threshold String (deduplication) . . (tenuring) . : String deduplication . 3 . -XX:+UseStringDeduplication . -XX:SurvivorRatio=ratio eden survivor . 8 . eden/survivor 4 : -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=percent (survivor space) ( ) . 50% . 30% : -XX:TargetSurvivorRatio=30 -XX:TLABSize=size ( ) (TLAB) . k K m M g G . 0 (JVM) . TLAB 512 KB : -XX:TLABSize=512k -XX:+UseAdaptiveSizePolicy . . -XX:-UseAdaptiveSizePolicy . -XX:SurvivorRatio . -XX:+UseG1GC Garbage-First (G1) . RAM . GC . G1 ( 6 GB ) GC ( 0.5 ) . G1 . -XX:+UseGCOverheadLimit JVM GC OutOfMemoryError . 98% 2% GC OutOfMemoryError . . -XX:-UseGCOverheadLimit . -XX:+UseNUMA (NUMA) . . -XX:+UseParallelGC (Parallel Scavenge ) . . -XX:+UseSerialGC (Serial GC) . . . -XX:+UseStringDeduplication (String deduplication) . . Garbage-First (G1) . String String . String String . -XX:+UseTLAB (TLAB) . . TLAB -XX:-UseTLAB . -XX:+UseZGC Z ( ZGC) . . . 8MB 16TB . -XX:ZAllocationSpikeTolerance=factor (allocation spike tolerance) ZGC . 2.0 . . 3.0 . -XX:ZCollectionInterval=seconds ( ) GC ZGC . 0 () . -XX:ZFragmentationLimit=percent ( ) ZGC . 25 . (compact) CPU . -XX:+ZProactive GC ZGC . . GC ZGC GC . . -XX:+ZUncommit (uncommit ) ZGC . . JVM . -XX:ZUncommitDelay=seconds ( ) . 300 ( ) . (committing) (uncommitting) . . -XX:+UseShenandoahGC Shenandoah . . . Shenandoah . -XX:UseCompressedOops . -XX:ShenandoahGCMode=mode GC Shenandoah GC . satb . (barriers) . : satb << >> (Snapshot-at-the-beginning) ( : -- mark-evac-update). GC . generational GC << >> (generational) . JEP 404 [https://openjdk.org/jeps/404] JEP 521 [https://openjdk.org/jeps/521] . -XX:ShenandoahGCHeuristics=heuristics (heuristics) Shenandoah GC . adaptive . GC GC . -XX:ShenandoahGCMode generational adaptive . : adaptive heap GC. static GC heap . compact GC . (DEPRECATED JAVA OPTIONS) java JDK . . -Xloggc:filename GC () . java -Xloggc -verbose:gc . -Xloggc:filename -Xlog:gc:filename . Enable Logging with the JVM Unified Logging Framework . : -Xlog:gc:garbage-collection.log -XX:+FlightRecorder Java Flight Recorder (JFR) . JDK 8u40 JFR . -XX:+ParallelRefProcEnabled (reference processing) . . throughput G1 (-XX:+UseParallelGC -XX:+UseG1GC). . -XX:MaxRAM=size JVM Java heap . JVM . JVM ( container) . compressed oops compressed oops . compressed oops -XX:UseCompressedOops . Java heap : -XX:MaxRAM=2G -XX:+AggressiveHeap Java heap . (RAM CPU) . heap . -XX:+NeverActAsServerClassMachine "Client VM emulation" C1 JIT CodeCache Serial GC . JVM ( -XX:MaxRAM=n) 1GB . "emulated-client" JVM . Windows true false . "Client VM emulation" : -XX:{+|-}TieredCompilation -XX:CompilationMode=mode -XX:TieredStopAtLevel=n -XX:{+|-}EnableJVMCI -XX:{+|-}UseJVMCICompiler java . --illegal-access=parameter (relaxed strong encapsulation) JEP 261 [https://openjdk.org/jeps/261#Relaxed-strong-encapsulation] . JDK 16 JEP 396 [https://openjdk.org/jeps/396] (deprecated) JDK 17 JEP 403 [https://openjdk.org/jeps/403] . (REMOVED JAVA OPTIONS) java JDK 26 . Removed Java Options : o The java Command, Release 25 [https://docs.oracle.com/en/java/javase/25/docs/specs/man/java.html] o The java Command, Release 24 [https://docs.oracle.com/en/java/javase/24/docs/specs/man/java.html] o The java Command, Release 23 [https://docs.oracle.com/en/java/javase/23/docs/specs/man/java.html] o The java Command, Release 22 [https://docs.oracle.com/en/java/javase/22/docs/specs/man/java.html] o The java Command, Release 21 [https://docs.oracle.com/en/java/javase/21/docs/specs/man/java.html] o The java Command, Release 20 [https://docs.oracle.com/en/java/javase/20/docs/specs/man/java.html] o The java Command, Release 19 [https://docs.oracle.com/en/java/javase/19/docs/specs/man/java.html] o The java Command, Release 18 [https://docs.oracle.com/en/java/javase/18/docs/specs/man/java.html] o The java Command, Release 17 [https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html] o The java Command, Release 16 [https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html] o The java Command, Release 15 [https://docs.oracle.com/en/java/javase/15/docs/specs/man/java.html] o The java Command, Release 14 [https://docs.oracle.com/en/java/javase/14/docs/specs/man/java.html] o The java Command, Release 13 [https://docs.oracle.com/en/java/javase/13/docs/specs/man/java.html] o Java Platform, Standard Edition Tools Reference, Release 12 [https://docs.oracle.com/en/java/javase/12/tools/java.html#GUID-3B1CE181-CD30-4178-9602-230B800D4FAE] o Java Platform, Standard Edition Tools Reference, Release 11 [https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID-741FC470-AA3E-494A-8D2B-1B1FE4A990D1] o Java Platform, Standard Edition Tools Reference, Release 10 [https://docs.oracle.com/javase/10/tools/java.htm#JSWOR624] o Java Platform, Standard Edition Tools Reference, Release 9 [https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624] o Java Platform, Standard Edition Tools Reference, Release 8 for Oracle JDK on Windows [https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BGBCIEFC] o Java Platform, Standard Edition Tools Reference, Release 8 for Oracle JDK on Solaris, Linux, and macOS [https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#BGBCIEFC] (JAVA COMMAND-LINE ARGUMENT FILES) @ ( ) java java . java . (@) java . java (@) . java --disable-@files . --disable-@files @ . java : o ASCII ASCII UTF-8. o MAXINT () . o (wildcards) . (*) VM . *.java *.java Foo.java Bar.java ... . o (white space) . o \t \n \r \f . c:\Program Files "c:\\Program Files" c:\Program" "Files . o ('"') . o \n \r \t \f . ASCII . o (double quotation) . o . o # (comments) . # . o @ @ (escape) ( @ ). o (\) . . (\) . o (\) . o (end-of-file) . o \ . o (@) ..SS -cp "lib/ cool/ app/ jars : -cp lib/cool/app/jars : -cp c:\Program Files (x86)\Java\jre\lib\ext;c:\Program Files\Java\jre9\lib\ext : -cp "c:\\Program Files (x86)\\Java\\jre\\lib\\ext;c:\\Program Files\\Java\\jre9\\lib\\ext" EOL -cp "/lib/cool app/jars:\ /lib/another app/jars" : -cp /lib/cool app/jars:/lib/another app/jars -cp "/lib/cool\ \app/jars" : -cp /lib/cool app/jars myargumentfile java : java @myargumentfile . path1/options path2/options . : java @path1/options @path2/classes (CODE HEAP STATE ANALYTICS) JVM : o JIT o o method sweeper (on-the-fly) . . . . ("on request") ..SS " (Syntax)" (real-time, on-the-fly) : jcmd pid Compiler.CodeHeap_Analytics [function] [granularity] (workload) code heap : -Xlog:codecache=Trace code heap "CodeCache full" (VM) : -Xlog:codecache=Debug code heap (granularity) CodeHeap State Analytics (OpenJDK) [https://bugs.openjdk.org/secure/attachment/75649/JVM_CodeHeap_StateAnalytics_V2.pdf] . JVM (ENABLE LOGGING WITH THE JVM UNIFIED LOGGING FRAMEWORK) -Xlog (JVM) . (SYNOPSIS) -Xlog[:[what][:[output][:[decorators][:output-options[,...]]]]] -Xlog:directive what (tags) (levels) tag1[+tag2...][*][=level][,...] . (*) . -Xlog Tags and Levels . output . output stdout . -Xlog Output . decorators (decorators) . decorators uptime level tags . Decorations . output-options -Xlog . directive : help disable async (DESCRIPTION) (JVM) JVM . GC JVM . GC Xlog Convert GC Logging Flags to Xlog . (runtime) JVM . Xlog Convert Runtime Logging Flags to Xlog . -Xlog : -Xlog JVM info . -Xlog:help -Xlog decorators . -Xlog:disable . -Xlog[:option] . -Xlog (override) . option : [tag-selection][:[output][:[decorators][:output-options]]] tag-selection all info . tag[+...] all all (meta tag) . (*) (wildcard) . . . output-options : filecount=file-count filesize=file size with optional K, M or G suffix foldmultilines= foldmultilines true '\' 'n' . . UTF-8 . Shift JIS BIG5 . -Xlog . warning error . : -Xlog:all=warning:stdout:uptime,level,tags ( jcmd) . VM.log . MBean JMX . -Xlog . JVM ( gc jit os). GC Xlog Convert GC Logging Flags to Xlog . Xlog Convert Runtime Logging Flags to Xlog . : o off o trace o debug o info o warning o error : . -Xlog:help . all . -Xlog -Xlog : o stdout --- stdout o stderr --- stderr o file=filename --- () . file=filename %p %t / %hn PID JVM . . 10 5 filesize=10M, filecount=5 . . 5 20 . filecount=0 . . -Xlog - . : -Xlog:async[:[stall|drop]] . . . (async:drop) (async:stall). async:drop . async:drop (non-blocking) . -XX:AsyncLogBufferSize=N . . ..SS (Decorations) . . . . . : [6.567s][info][gc,old] Old collection complete decorators uptime level tags . none . time (t) utctime (utc) uptime (u) timemillis (tm) uptimemillis (um) timenanos (tn) uptimenanos (un) hostname (hn) pid (p) tid (ti) level (l) tags (tg) none . ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- time t ISO-8601. utctime utc (Universal Time Coordinated Coordinated Universal Time). uptime u JVM . 6.567s. timemillis tm System.currentTimeMillis(). uptimemillis um JVM. timenanos tn System.nanoTime(). uptimenanos un JVM. hostname hn (hostname). pid p (PID). tid ti (Thread identifier). level l . tags tg . GC Xlog GC Xlog tab( ); lw(22.4n) lw(16.5n) lw(31.2n). (GC) Xlog T} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- G1PrintHeapRegions -Xlog:gc+region=trace T} GCLogFileSize . T} NumberOfGCLogFiles . T} PrintAdaptiveSizePolicy -Xlog:gc+ergo*=level level debug level trace PrintAdaptiveSizePolicy . T} PrintGC -Xlog:gc T} PrintGCApplicationConcurrentTime -Xlog:safepoint PrintGCApplicationConcurrentTime PrintGCApplicationStoppedTime . T} PrintGCApplicationStoppedTime -Xlog:safepoint PrintGCApplicationConcurrentTime PrintGCApplicationStoppedTime . T} PrintGCCause GC . T} PrintGCDateStamps . T} PrintGCDetails -Xlog:gc* T} PrintGCID GC . T} PrintGCTaskTimeStamps -Xlog:gc+task*=debug T} PrintGCTimeStamps . T} PrintHeapAtGC -Xlog:gc+heap=trace T} PrintReferenceGC -Xlog:gc+ref*=debug PrintReferenceGC PrintGCDetails . T} PrintStringDeduplicationStatistics `-Xlog:gc+stringdedup*=debug ` T} PrintTenuringDistribution -Xlog:gc+age*=level level debug level trace PrintTenuringDistribution . T} UseGCLogFileRotation PrintTenuringDistribution . T} . . Xlog tab( ); lw(15.0n) lw(20.2n) lw(34.7n). Xlog T} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- TraceExceptions -Xlog:exceptions=info T} TraceClassLoading -Xlog:class+load=level level=info level=debug . (Unified Logging) -verbose:class -Xlog:class+load=info,class+unload=info . T} TraceClassLoadingPreorder -Xlog:class+preorder=debug T} TraceClassUnloading -Xlog:class+unload=level level=info level=trace . (Unified Logging) -verbose:class -Xlog:class+load=info,class+unload=info . T} VerboseVerification -Xlog:verification=info T} TraceClassPaths -Xlog:class+path=info T} TraceClassResolution -Xlog:class+resolve=debug T} TraceClassInitialization -Xlog:class+init=info T} TraceLoaderConstraints -Xlog:class+loader+constraints=info T} TraceClassLoaderData -Xlog:class+loader+data=level level=debug level=trace . T} TraceSafepointCleanupTime -Xlog:safepoint+cleanup=info T} TraceSafepoint -Xlog:safepoint=debug T} TraceMonitorInflation -Xlog:monitorinflation=debug T} TraceRedefineClasses -Xlog:redefine+class*=level level=info debug trace . T} -Xlog . -Xlog info uptime levels tags stdout . : -Xlog:all=info:stdout:uptime,levels,tags -Xlog:gc gc info stdout . warning . -Xlog:gc,safepoint gc safepoint info stdout . gc safepoint . -Xlog:gc+ref=debug gc ref debug stdout . . -Xlog:gc=debug:file=gc.txt:none gc debug gc.txt . warning . -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pid:filecount=5,filesize=1024 gc trace gctrace.txt uptimemillis pid . warning . -Xlog:gc::uptime,tid gc 'info' stdout uptime tid . warning . -Xlog:gc*=info,safepoint*=off gc info safepoint . gc safepoint . -Xlog:disable -Xlog:safepoint=trace:safepointtrace.txt safepoint trace safepointtrace.txt . -Xlog:disable . " -Xlog (Complex -Xlog Usage Examples)" -Xlog . -Xlog:gc+class*=debug gc class debug stdout . warning . -Xlog:gc+meta*=trace,class*=off:file=gcmetatrace.txt gc meta trace metatrace.txt class . gc meta class class* (off) . warning class . -Xlog:gc+meta=trace gc meta trace stdout . warning . -Xlog:gc+class+heap*=debug,meta*=warning,threads*=off gc class heap trace stdout meta . warning threads ..SH " (VALIDATE JAVA VIRTUAL MACHINE FLAG ARGUMENTS)" (JVM) . (ergonomic) API ( java.lang.management) (JVM) . << >> (Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide) . JVM ( jcmd) . JVM . JVM : java -XX:AllocatePrefetchStyle=5 -version intx AllocatePrefetchStyle=5 is outside the allowed range [ 0 ... 3 ] Improperly specified VM option 'AllocatePrefetchStyle=5' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. -XX:+PrintFlagsRanges . . . : intx ThreadStackSize [ 0 ... 9007199254740987 ] {pd product} . : size_t NewSize [ ... ] {product} . . " (LARGE PAGES)" (large pages) huge pages ( ) . (Translation-Lookaside Buffers TLB) . (TLB) . TLB . TLB miss . TLB . TLB . . () . (fragmentation) . JVM . ..SS " (Large Pages Support for Linux)" 2.6 . : # cat /proc/meminfo | grep Huge HugePages_Total: 0 HugePages_Free: 0 ... Hugepagesize: 2048 kB "Huge" . . Hugepagesize . . : # ls /sys/kernel/mm/hugepages/ hugepages-1048576kB hugepages-2048kB JVM . ( -XX:+UseTransparentHugePages) . root : # echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages nr_hugepages . : /proc /sys ( rc.local sysctl.conf) . (Java heap) : o 2 (Code cache) o 2 (Marking bitmaps) nr_hugepages JVM . " (Large Pages Support for Windows)" : "1." 3 Control Panel Administrative Tools Local Security Policy . "2." 3 Local Policies User Rights Assignment . "3." 3 Lock pages in memory / . "4." 3 . . " (APPLICATION CLASS DATA SHARING)" (AppCDS) . ( JAR) AppCDS . AppCDS . CDS JAR JDK . . . API ..SS CDS JDK -Xshare:off JVM CDS JAVA_HOME/lib/server/classes.jsa ( JAVA_HOME\bin\server\classes.jsa ) . . CDS -XX:SharedArchiveFile : -XX:SharedArchiveFile=: o 2 CDS . o 2 . o 2 : ; . "static" () "dynamic" () . CDS . CDS/AOT AOT . (JVM) . : -XX:SharedArchiveFile= . : -XX:SharedArchiveFile= CDS CDS : o 2 -Xshare:dump o 2 -XX:ArchiveClassesAtExit o 2 jcmd VM.cds " " (trial run) . CDS -Xshare:dump CDS test.Hello . "1." 3 test.Hello. hello.classlist : 4 java -Xshare:off -XX:DumpLoadedClassList=hello.classlist -cp hello.jar test.Hello (classpath) -cp JAR . "2." 3 hello.jsa hello.classlist : 4 java -Xshare:dump -XX:SharedArchiveFile=hello.jsa -XX:SharedClassListFile=hello.classlist -cp hello.jar "3." 3 test.Hello hello.jsa: 4 java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hello "4." 3 test.Hello hello.jsa : 4 java -XX:SharedArchiveFile=hello.jsa -cp hello.jar -Xlog:class+load test.Hello : [info][class,load] test.Hello source: shared objects file -Xshare:dump JVM (interpreter-only) ( -Xint ). (deterministic) . (classlist) -Xmixed JIT . ..SS CDS -XX:ArchiveClassesAtExit CDS : o 2 . o 2 . CDS test.Hello CDS . "1." 3 CDS hello.jsa hello.jar test.Hello : 4 java -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello "2." 3 test.Hello hello.jsa: 4 java -XX:SharedArchiveFile=hello.jsa -cp hello.jar test.Hello "3." 3 test.Hello hello.jsa . CDS CDS . java -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello CDS: java -XX:SharedArchiveFile=base.jsa:hello.jsa -cp hello.jar Hello ( Windows : ; ) : java -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello CDS jcmd CDS . class path . jcmd VM.cds JVM CDS . : jcmd VM.cds static_dump my_static_archive.jsa : jcmd VM.cds dynamic_dump my_dynamic_archive.jsa : env JAVA_TOOL_OPTIONS=-XX:SharedArchiveFile=my_static_archive.jsa bash app_start.sh : jcmd VM.cds dynamic_dump JVM -XX:+RecordDynamicDumpInfo : env JAVA_TOOL_OPTIONS=-XX:+RecordDynamicDumpInfo bash app_start.sh -XX:+AutoCreateSharedArchive / CDS . CDS -XX:+AutoCreateSharedArchive . CDS . java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello JDK VM . VM . JDK ( JDK 19) . JVM . JDK JDK 19 : . CDS JDK . JDK -XX:+AutoCreateSharedArchive JDK . JDK . Class Path Module Path o 2 (-classpath -Xbootclasspath/a) (--module-path) . o 2 JAR --module-path . (Exploded modules) . o 2 ( ). ( .) o 2 JAR CDS . CDS : --module-path --module --add-modules --enable-native-access. ( ) CDS . CDS . o 2 AOTClassLinking ( ) CDS CDS : 2 CDS archive has aot-linked classes. It cannot be used when archived full module graph is not used o 2 AOTClassLinking CDS CDS "archived module graph" . . AOT -Xlog:aot VM . --add-modules jdk.jconsole --add-modules jdk.incubator.vector : Mismatched values for property jdk.module.addmods runtime jdk.incubator.vector dump time jdk.jconsole subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled VM --upgrade-module-path --patch-module --limit-modules CDS . JVM CDS . CDS JVM ..SH " (AHEAD-OF-TIME CACHE)" JDK (AOT) . Class Data Sharing (CDS) ( ) . AOT (start-up) (warm-up) Java . (AOT cache) JDK 24 AOT . AOT Java (heap) . JDK AOT . AOT : o 2 ( -classpath -jar --module-path ). o 2 JDK. o 2 (CPU) . AOT . AOT : o 2 (Training): AOT . AOT Configuration . o 2 (Assembly): AOT AOT . o 2 (Production): AOT . AOT : -XX:AOTCache=cachefile AOT . cachefile .aot . -XX:AOTCacheOutput . on create auto () AOTMode . cachefile AOT on auto off . cachefile AOT create . -XX:AOTCacheOutput=cachefile . -XX:AOTCacheOutput=cachefile AOT . cachefile .aot . -XX:AOTCache . record create auto () AOTMode . -XX:AOTConfiguration=configfile AOT JVM . configfile .aotconfig . record create auto () AOTMode . configfile AOT create . AOT auto AOTCacheOutput . -XX:AOTMode=mode AOT . mode : auto off record create on. o 2 auto: AOT -XX:AOTMode . AOT record on off : 2 o 2 -XX:AOTCacheOutput=cachefile AOT record ( create). o 2 AOT AOT on ( ). o 2 AOT off ( AOT). o 2 off: AOT . AOT . o 2 record: . -XX:AOTConfiguration=configfile / -XX:AOTCacheOutput=cachefile . -XX:AOTConfiguration=configfile JVM configfile . -XX:AOTConfiguration=configfile JVM AOTCacheOutput+".config" . -XX:AOTCacheOutput=cachefile JVM cachefile . 2 JVM JDK_AOT_VM_OPTIONS JAVA_TOOL_OPTIONS JVMTI [https://docs.oracle.com/en/java/javase/24/docs/specs/jvmti.html#tooloptions] JVM . o 2 create: . -XX:AOTConfiguration=configfile . JVM configfile cachefile . . o 2 on: (Production) . -XX:AOTCache=cachefile JVM cachefile AOT . JVM default CDS archive JDK AOT . 2 AOT : o 2 AOT JDK / . o 2 cachefile . o 2 JVM ( JVMTI). 2 AOT JVM . AOT Consistency of training and subsequent runs JEP 483 [https://openjdk.org/jeps/483] . . AOT : o 2 AOTMode auto JVM AOT . ( ). AOT . o 2 AOTMode on JVM . << >> ("fail-fast") AOT . -XX:AOTMode=auto -Xlog:aot AOT . -XX:+AOTClassLinking JVM AOT ( invokedynamic) . . AOT . -XX:+AOTClassLinking JEP 483 [https://openjdk.org/jeps/483] . -XX:AOTMode AOTClassLinking . -XX:-AOTClassLinking . -XX:AOTMode AOTClassLinking CDS `-Xshare:dump . %p *configfile* cachefile (PID) JVM %t JVM . ( %p %t .) : java -XX:AOTConfiguration=foo%p.aotconfig -XX:AOTCacheOutput=foo%p.aot -cp foo.jar Foo : foopid123.aotconfig foopid123.aot 123 JVM Foo . " (PERFORMANCE TUNING EXAMPLES)" . " " (Throughput) : java -server -XX:+UseParallelGC -XX:+UseLargePages -Xmn10g -Xms26g -Xmx26g " " : java -XX:+UseG1GC -XX:MaxGCPauseMillis=100 " Java Heap " Java heap (Embedded) : -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 : 70% 40% . . " (EXIT STATUS)" JVM . API System.exit(exitValue) . : o 2 0: o 2 >0: JDK 26.0.2.1 2026 JAVA(1)