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. (For J2SE 1.2.2, the example applications may be obtained from the JPDA download page.)
In increasing order of complexity:
- Trace displays traces of program execution. It is very simple (less than 600 lines) yet uses most of the basic JDI functionality. It is a good starting point.
- Jdb is the command line debugger distributed with the J2SE SDK v1.3 and later releases.
- Javadt is the beginnings of a GUI debugger.
Trace is in the
trace
directory. Jdb and Javadt share a package, and are in thedebuggers
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 J2SE tools documentation.