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:
HPROF
JConsole
jdb
jhat
jinfo
jmap
jps
(not currently available on Windows 98 or Windows ME)
jrunscript
jstack
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 java.util.concurrent
locks.
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.
The 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.
The 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.
The jinfo
tool has the following changes:
The new jinfo -flag
option allows you to dynamically set, unset, and change the values of certain Java VM flags for a specified Java process.
The jinfo
command is new to Windows, but it only supports the -flag
option.
The jmap
command has the following changes:
The jmap -finalizerinfo
option is new. With this option, the command prints information on objects awaiting finalization.
The jmap -permstat
option has been updated to print also the number and size of internalized String instances.
The 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 jhat
tool.
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.
The 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.
The live
sub-option is new for the -histo
option. With this sub-option only live objects are counted.
The jmap
command is new to Windows, but it only supports the -dump:
dump-options option and the -histo[:live]
option.
The jrunscript
tool is new.
The jstack
command has the following changes:
The 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).
The 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.
The jstack -l
option is new. This option prints information about ownable synchronizers (locks) in the heap.
The jstack
command is new to Windows, but it only supports the jstack
pid option and the jstack -l
pid option.
The -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 jmap
).
The -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 -XX:+HeapDumpOnOutOfMemoryError
Option.
Other new environment variables to help in troubleshooting OutOfMemoryError
exceptions are the following:
-XX:HeapDumpPath=
pathname
-XX:SegmentedHeapDumpThreshold=
threshold
-XX:HeapDumpSegmentSize=
size
The fatal error log has the following changes:
You now have the ability to specify a location for the fatal error log (see "Location of Fatal Error Log").
There is now a URL at the beginning of the fatal error log for reporting incidents (see "Header Format").
The VM now contains two built-in DTrace probe providers: hotspot
and hotspot_jni
. (Solaris 10 OS only)
The 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.
With -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.
The format=b
option for HPROF now includes primitive type instance fields and primitive array content in heap dumps.
When the 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.