Java stack (jstack) tool

Use the jstack tool to obtain Java stack traces and thread information for processes. The tool is similar to the HotSpot tool of the same name; the OpenJ9 version of jstack is an independent implementation, added for compatibility.

The command syntax is as follows:

jstack <options>* <pid>*

Where <pid>* is a list of process IDs. If none are supplied, the process IDs are read from stdin, which allows a user running a Bourne or equivalent shell to query all processes via jps -q | jstack. IDs of inactive processes are silently ignored. The output contains Java stacks and thread information of the specified processes (equivalent to the information provided in java.lang.management.ThreadInfo).

The values for <options>* are as follows:

  • -J: supplies arguments to the Java VM that is running the jstack command. You can use multiple -J options, for example: jstack -J-Xmx10m -J-Dcom.ibm.tools.attach.enable=yes
  • -p: prints the system and agent properties of the process
  • -l: prints more verbose output, including information about locks
  • -h: prints help information

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 more information about differences, see Switching to OpenJ9.