For v1.3.0 and later releases, the Java 2 SDK's demo/jpda directory contains source code and documentation for three applications written using the Java Debug Interface (JDI) of the Java Platform Debugger Architecture (JPDA). They are provided as educational tools and as starting points for debugger development.
In increasing order of complexity:
Trace is in the trace
directory. Jdb and Javadt share a
package, and are in the debuggers
directory.
Your classpath must include the JDI Library code, which is in lib/tools.jar
directory of the Java 2 SDK. (Note that tools.jar is not in
the Java Runtime Environment; it is only in the Java 2 SDK.)
This is needed for both compiling the example code and executing it.
For information on how to set the classpath, see the Java SE tools documentation.