"jcmd 0 Thread.print" - Generating Thread Dump

This section provides a tutorial example on how to use the 'jcmd 0 Thread.print' command to generate a thread dump of a given JVM.

Another nice diagnostic command is the "jcmd 0 Thread.print" command, which generates the thread dump of a given JVM:

herong> jcmd LongSleep Thread.print | more
7192:
Full thread dump Java HotSpot(TM) 64-Bit Server VM (10.0.1+10 mixed mode):

Threads class SMR info:
_java_thread_list=0x0000000023d4d420, length=11, elements={...}

"main" #1 prio=5 os_prio=0 tid=0x0000000000490800 nid=0x1780 waiting on
condition  [0x0000000001ebf000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(java.base@10.0.1/Native Method)
        at LongSleep.main(LongSleep.java:9)

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x0000000021de6800
nid=0x2bb8 waiting on condition  [0x00000000232ff000]
   java.lang.Thread.State: RUNNABLE
  at java.lang.ref.Reference.waitForReferencePendingList(...)
  at java.lang.ref.Reference.processPendingReferences(...)

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x0000000021dea800 nid=0xa50
in Object.wait()  [0x000000002352f000]
   java.lang.Thread.State: WAITING (on object monitor)
  at java.lang.Object.wait(java.base@10.0.1/Native Method)
  - waiting on <0x00000000c7b09410> (a java.lang.ref.ReferenceQueue$Lock)
  at java.lang.ref.ReferenceQueue.remove(java.base@10.0.1/...)
...

As I expected, this is a quick way to generate a thread dump.

Table of Contents

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

jcmd - The JVM Diagnostic Tool

 jcmd - JVM Diagnostic Tool Command

 "jcmd 0 help" - Listing JVM Diagnostic Commands

 "jcmd 0 VM.*" - Running VM Diagnostic Commands

 "jcmd 0 GC.*" - Running GC Diagnostic Commands

"jcmd 0 Thread.print" - Generating Thread Dump

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials

 References

 Full Version in PDF/EPUB