Java Tool Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 5.11

JVM Troubleshooting Tools

This chapter tutorial notes on JVM troubleshooting tools. Topics include 'jinfo' to check JVM option values, 'jstack' to dump stack traces and detect deadlocks, 'jmap' to print heap histogram and dump heap files, 'jhat' to browse head files and run OQL queries.

JVM Troubleshooting Tools in JDK 1.5

'jinfo' - VM Option Value Checker

Changing HotSpot VM Option using 'jinfo'

'jstack' - Stack Tracer of JVM Threads

Java Thread Deadlock Demo Program

Detecting Java Thread Deadlocks with 'jstack'

'jmap' - JVM Heap Dump Tool

Printing Histogram of Java Object Heap

Generating Heap Dump File with 'jmap'

'jhat' - Java Heap Analysis Tool

Starting 'jhat' Web Server on a Heap Dump File

Listing Instance Counts of All Classes

Browsing Object Instance Values

Object Query Language (OQL)

Searching for Instances with OQL Statements

Conclusions:

  • JDK 1.6 offers a number of nice trouble shooting tools: jinfo, jstack, jmap, and jhat.
  • jinfo allows you to check current VM options of a running JVM process.
  • jstack allows you to dump thread stack traces and find any deadlocks.
  • jmap allows you to print heap memory usages and instance counts by classes and dump the entire heap to a file.
  • jhat allows you to browse a heap dump file with a Web interface.
  • jhat also supports OQL (Object Query Language) statements - a very powerful tool to investigate any data issues in your Java application.

Dr. Herong Yang, updated in 2008
JVM Troubleshooting Tools