This appendix presents a summary of tools available in the current release of the JDK, as well as the changes since the previous release.
All the JDK troubleshooting tools that are described in this document are available in JDK 7 on both Solaris OS and Linux.
The following JDK troubleshooting tools are also available in JDK 7 on Windows:
jps (not currently available on Windows 98 or Windows ME)
jstat (not currently available on Windows 98 or Windows ME)
jstatd (not currently available on Windows 98 or Windows ME)
visualgc (not currently available on Windows 98 or Windows ME)
This is a list of changes to the JDK troubleshooting tools and options from JDK 1.5 to JDK 7.
The Java VisualVM tool is included in JDK releases starting with release 6 update 7.
The Heap Analysis Tool (HAT) has been replaced by the new
jhat command-line tool. This new tool has the same functionality as HAT, with the following additional enhancements:
jhat can parse incomplete and truncated heap dumps.
jhat can read heap dumps generated on 64-bit systems.
jhat supports Object Query Language (OQL), which you can use to create your own queries on the heap dump.
The JConsole tool has the following changes:
A new user interface (button) is provided for deadlock detection, including
The Connection dialog is new.
The Overview tab is new.
You no longer need to specify the
-Dcom.sun.management.jmxremote command-line option when starting the application to be monitored.
You can connect to a VM using the attach mechanism.
You can pass a flag on the command line to the VM that is running JConsole.
com.sun.management.HotSpotDiagnostic MBean property is new. In the MBean tab, you can use this property to dump heap, get and set VM options, and change management options dynamically.
jdb tool has the following changes:
Shows return values in method and exit traces.
Trace method entry/exit without stopping.
The Java Platform Debugger Architecture (JPDA)
ProcessAttachingConnector is new.
jinfo tool has the following changes:
jinfo -flag option allows you to dynamically set, unset, and change the values of certain Java VM flags for a specified Java process.
jinfo command is new to Windows, but it only supports the
jmap command has the following changes:
jmap -finalizerinfo option is new. With this option, the command prints information on objects awaiting finalization.
jmap -permstat option has been updated to print also the number and size of internalized String instances.
jmap -dump:format=b,file=filename option is new. With this option,
jmap obtains a heap dump from a running process or from a core file and writes it in binary HPROF format to a specified file. This file can then be analyzed with the
jmap -F option is new and is supported on Solaris OS and Linux only. This option forces the use of the Serviceability Agent in case the process does not respond.
jmap -J option is new and is supported on Solaris OS and Linux only. This option passes flags to the VM on which
jmap is running.
live sub-option is new for the
-histo option. With this sub-option only live objects are counted.
jmap command is new to Windows, but it only supports the
-dump:dump-options option and the
jrunscript tool is new.
jstack command has the following changes:
jstack pid option has been changed to work like remote Control+Break (that is, the output of the thread dump is slightly different, and there is more information on deadlocks and JNI Global References).
jstack -F option is new and is supported on Solaris OS and Linux only. This option forces a thread dump in case the VM is hung.
jstack -l option is new. This option prints information about ownable synchronizers (locks) in the heap.
jstack command is new to Windows, but it only supports the
jstack pid option and the
jstack -l pid option.
-XX:OnOutOfMemoryError=string option allows you to specify a command or script to be run when an
OutOfMemoryError exception is thrown. This is useful for data capture (for example, with
-XX:+HeapDumpOnOutOfMemoryError command-line option is new as of JDK release 5 update 7. If this option is set and the VM detects a native
OutOfMemoryError exception, a heap dump is generated. For more information, see The
Other new environment variables to help in troubleshooting
OutOfMemoryError exceptions are the following:
The fatal error log has the following changes:
The VM now contains two built-in DTrace probe providers:
hotspot_jni. (Solaris 10 OS only)
fastdebug builds can be useful for testing, diagnosing, and isolating problems. However, they should not be used in production environments.
The Control+Break handler has the following changes:
Control+Break now shows the thread state.
Control+Break now shows the sizes of the heap areas.
-XX:+PrintConcurrentLocks, Control+Break will also print the list of concurrent locks owned by each thread, as well as detect deadlocks involving both monitor locks and concurrent locks.
format=b option for HPROF now includes primitive type instance fields and primitive array content in heap dumps.
java.lang.OutOfMemoryError exception is thrown, a stack trace is now printed also. In addition, when the specific message indicates that the system is almost out of swap space (Out of swap space?), a fatal error log is now generated.