The JDK has extensive APIs for developing custom tools to observe, monitor, profile, debug, and diagnose issues in applications that are deployed in the JRE. The development of new tools is beyond the scope of this document. Instead this section provides a brief overview of the APIs available.
All the packages mentioned in this section are described in the Java SE API specification.
Refer also to example and demonstration code that is included in the JDK download.
The following sections describe packages, interface classes, and the Java debugger that can be used as custom diagnostic tools for troubleshooting.
The Java Platform Debugger Architecture (JPDA) is the architecture designed for use by debuggers and debugger-like tools. It consists of two programming interfaces and a wire protocol.
The Java Virtual Machine Tool Interface (JVM TI) is the interface to the virtual machine, see JVM Tool Interface.
The Java Debug Interface (JDI) defines information and requests at the user code level. It is a pure Java programming language interface for debugging Java programming language applications. In JPDA, the JDI is a remote view in the debugger process of a virtual machine in the process being debugged. It is implemented by the front end, where as a debugger-like application (for example, IDE, debugger, tracer, or monitoring tool) is the client.
The Java Debug Wire Protocol (JDWP) defines the format of information and requests transferred between the process being debugged and the debugger front end, which implements the JDI.
For a complete description of JDPA connection and invocation details, see Java Platform Debugger Architecture (JDPA) documentation.
The jdb
utility is included in the JDK as an example command-line debugger. The jdb
utility uses the JDI to launch or connect to the target VM. For more information about the jdb
utility, see The jdb Utility.
In addition to traditional debugger-type tools, the JDI can also be used to develop tools that help in postmortem diagnostics and scenarios where the tool needs to attach to a process in a noncooperative manner (for example, a hung process).