Java diagnostic command (
jcmd tool to run diagnostic commands on a specified VM.
Note: Running diagnostic commands can significantly affect the performance of the target VM.
The command syntax is as follows:
jcmd [<options>] [<vmid> <arguments>]
-J: supplies arguments to the Java VM that is running the
jcmdcommand. You can use multiple
-Joptions, for example:
jcmd -J-Xmx10m -J-Dcom.ibm.tools.attach.enable=yes
-h: prints the
<vmid>is the Attach API virtual machine identifier for the Java™ VM process. This ID is often, but not always, the same as the operating system process ID. One example where the ID might be different is if you specified the system property
-Dcom.ibm.tools.attach.idwhen you started the process. You can use the
jpscommand to find the VMID.
help: shows the diagnostic commands that are available for this VM. This list of commands can vary between VMs.
help <command>: shows help information for the specified diagnostic command
<command> [<command_arguments>]: runs the specified diagnostic command, with optional command arguments
jcmd 31452 Thread.print jcmd 31452 help Dump.heap jcmd 31452 Dump.heap myHeapDump
Restrictions: This tool is not supported and is subject to change or removal in future releases. Although similar in usage and output to the HotSpot tool of the same name, this tool is a different implementation that is specific to OpenJ9. For information about the differences between these two implementations, see Switching to OpenJ9.
The tool uses the Attach API, and has the following limitations:
- Displays information only for local processes that are owned by the current user, due to security considerations.
- Displays information for OpenJ9 Java processes only
- Does not show information for processes whose Attach API is disabled. Note: The Attach API is disabled by default on z/OS.
For more information about the Attach API, including how to enable and secure it, see Support for the Java Attach API.