'jhat' - Java Heap Analysis Tool

This section describes the Java heap analysis tool 'jhat' command and its options. 'jhat' can be used browse a Java heap dump file through a Web interface.

"jhat" - Java heap analysis tool or heap dump file browser: Parses a Java heap dump file and launches a Web server. "jhat" enables you to browse heap dump files using your favorite webbrowser. "jhat" supports pre-designed queries (such as 'show all instances of a known class "Foo"') as well as OQL (Object Query Language) - a SQL-like query language to query heap dumps. Help on OQL is available from the OQL help page shown by "jhat". With the default port, OQL help is available at http://localhost:7000/oqlhelp/

But the "jmap" tool included in the Windows version of JDK 1.6 only supports functions to print histogram of Java object heap and generate a heap dump of a given JVM process:

C:\herong>\Progra~1\java\jdk1.8.0\bin\jhat -help

Usage: jhat [-stack <bool>] [-refs <bool>] [-port <port>] 
   [-baseline <file>] [-debug <int>] [-version] [-h|-help] <file>

   -stack false     Turn off tracking object allocation call stack.
   -refs false      Turn off tracking of references to objects
   -port <port>     Set the port for the HTTP server. Default is 7000.
   -exclude <file>  Specify a file that lists data members that should
                    be excluded from the reachableFrom query.
   -baseline <file> Specify a baseline object dump.  Objects in
                    both heap dumps with the same ID and same class 
                    will be marked as not being "new".
   -debug <int>     Set debug level.
                    0:  No debug output
                    1:  Debug hprof file parsing
                    2:  Debug hprof file parsing, no server
   -version         Report version number
   -h|-help         Print this help and exit
   <file>           The file to read

For a dump file that contains multiple heap dumps,
you may specify which dump in the file
by appending "#<number>" to the file name, i.e. "foo.hprof#3".

All boolean options default to "true"

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

 JVM Troubleshooting Tools in JDK 1.5

 'jinfo' - VM Option Value Checker

 Changing HotSpot VM Option using 'jinfo'

 'jstack' - Stack Tracer to Generate Thread Dump

 What Is a Thread Dump?

 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

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 PDF Printing Version