Java(tm) Developers Kit
Java(tm) Language Debugging To help you learn how to use the Java Debugger (JDB), here are two tutorials:
A debugger for the Java(tm) Programming Language needs four features:
To fulfill these requirements, the Java Debugger API was developed. This API supports the model of a remote viewer to a running Java Language Runtime, with proxy support for objects under observation. For example, there are classes for RemoteObject, RemoteStackFrame, etc.
This API defines a RemoteDebugger class which serves as a viewer for the Java Language Runtime being debugged. This class's methods perform general operations, such as returning arrays of RemoteClass or RemoteThread. More specific operations are supported through the methods of these classes. To get a class's methods, for example, the RemoteClass method getMethod() would be used. To print one of those methods' names, use its getName() method.
JDB serves both as a "proof of concept" for the Java Debugger API, and as a useful debugging tool in its own right. The TTY class implements a dbx-like debugger which supports browsing of objects written in the Java Programming Language as well as basic debugging. Tools developers are strongly encouraged to come up with something more user-friendly. <grin>
The debugger communicates with the java interpreter being debugged via a socket-based, proprietary protocol. This protocol is neither public nor extensible by debugging clients, primarily for security reasons.
The Java Language Runtime can only be debugged if started with the "-debug" flag. When started this way, the interpreter prints out a password to be used by the debugger, and begins listening on a dynamically allocated port. The debugger must specify the correct host and password when creating the RemoteDebugger instance.
Only one debugger may be connected to a Java interpreter in debug mode.
Java Developers Kit