NonStop Server for Java Tools Reference (NSJ 4.0+)

Description
The Java Debugger, jdb, is a simple command-line debugger for Java classes. It is
an example of the use of the Java Platform Debugger Architecture that provides
inspection and debugging of a local or remote Java virtual machine (VM).
Starting a jdb Session
There are many ways to start a jdb session. The most frequent way is to have jdb
launch a new Java VM with the main class of application to be debugged. You do
this by substituting the command jdb for the command java in the command
line. For example, if your application's main class is named MyClass, you use the
following command to debug it under JDB:
jdb MyClass
When started this way, jdb invokes a second Java VM with any specified
parameters, loads the specified class, and stops the Java VM before executing the
first instruction of that class.
Another way to use jdb is by attaching it to a Java VM that is already running. A
Java VM that is to be debugged with jdb must be started with the following java
options:
Option Purpose
-Xdebug
Enables
debugging
support in
the Java
VM.
-Xrunjdwp:transport=dt_socket,
server=y,suspend=n
Loads
in-process
debugging
libraries and
specifies the
kind of
connection
to be made.
For example, the following command runs the MyClass application and allows
jdb to connect to the application at a later time.
java -Xdebug -Xrunjdwp:transport=dt_socket,\
address=8000,server=y,suspend=n MyClass