In this blog post, We are going to learn JCMD command line utility with examples.
JCMD is command line utility tool to diagnose the java process. This will be useful in Java applications to debug the following use cases.
This tool is available as part of Java JDK installation.
This sends a diagnostic signal to retrieve JVM debugging information process id and class
This single tool answers most of the below questions
The options are -l and -h When there are no potions provided, It prints list of java process -f option This option allows to read the commands from the file -l option Displays list of java process information -h help option
5412 sun.tools.jcmd.JCmd -l
The above command gives process id and process name running in JVM. Next is to get detailed diagnostic information with each process, we need to run one more command to get the list of commands
B:\Workspace\modifysf>jcmd org.codehaus.plexus.classworlds.launcher.Launcher help
The following commands are available:
For more information about a specific command use 'help '.
java flight recorder analyses the recordings and allows to get micro details about applications and JVM. This feature is available in java commercial license. To make use of this recordings, First, we need to enable it in the application
java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder
JFR.stop - stop the recording JFR.start - This option allows to start the recordings JFR.dump - This dumps all the data JFR. check - This returns the status of recording of a process
native memory usage will not be tracked. The application can be enabled by starting the application with -XX:NativeMemoryTracking=detail Here is the command for native memory for the specific process
jcmd org.codehaus.plexus.classworlds.launcher.Launcher VM.native_memory
jting - Nov 1, 2018
This comment has been removed by a blog administrator.