JVM - jcmd

The jcmd utility is used to send diagnostic command requests to the JVM, where these requests are useful for controlling Java Flight Recordings, troubleshoot, and diagnose JVM and Java Applications. It must be used on the same machine where the JVM is running, and have the same effective user and group identifiers that were used to launch the JVM.
 Sample
 jcmd
 jcmd <process id/main class> PerfCounter.print
 jcmd 2125 help //2125 is the pid
 jcmd 2125 GC.heap_dump filename=Myheapdump
 jcmd 2125 VM.uptime
 jcmd <process id/main class> VM.system_properties
 jcmd <process id/main class> VM.flags
 jcmd MyProgram help Thread.print
 jcmd <process id/main class> Thread.print
 jcmd <process id/main class> <command> [options]
 jcmd 7060 JFR.start name=MyRecording settings=profile delay=20s duration=2m filename=C:TEMPmyrecording.jfr
 jcmd 7060 JFR.check
 jcmd 7060 JFR.stop

jcmd man page: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jcmd.html
Useful Commands for jcmd Utility: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html#BABEJDGE 
Troubleshoot with jcmd Utility: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html#BABFFIFA

标签: none