Write once, debug/test everywhere is a variant on Java's write once, run anywhere claim, and it defines the Java Platform Debugger Architecture (JPDA).
The JPDA is a client/server system built from three application programming interfaces (APIs). The Java Debug Interface (JDI) is the client interface used by a Java debugger to access the debugging facilities. The JDI uses the Java Debug Wire Protocol (JDWP), which differs from the Java interface definitions associated with the other JPDA APIs.
The JDWP only defines the format of the packets passed between the JDI and the Java Virtual Machine Debug Interface (JVMDI), along with the semantics associated with the data. This allows implementations to exploit any kind of transport mechanism from in-memory exchange between a debugger and application running on the same machine to a TCP/IP connection across the Internet. Keeping the JDWP generic makes it relatively easy to build a debugger on any platform, not just Java.
The JVMDI tells a Java virtual machine (JVM) vendor how to implement a debugging interface to a JVM. Hiding the application behind this interface lets the JVM be implemented in many ways, from a Java bytecode interpreter to a just-in-time (JIT) native code compiler.
The JPDA APIs can be implemented in Java, though it's not a requirement. Sun provides the JDPA library with the associated class and interface definitions. It's used with Sun's JVMs or compatible third-party JVMs. Embedded JVMs often implement the JVMDI and JDWP, with the JDWP supported by a transport mechanism such as a TCP/IP stack. In this case, the debugger is on a remote system, which is typical for embedded development environments.
PICK YOUR JAVA DEBUGGER
The advantage of the JDPA is its ability to choose a debugger instead of being restricted to one for a particular Java platform. Often the vendor's matching debugger will have access to additional JVM or operating-system functionality. However, almost any Java debugger can handle application development.
A number of Java debuggers suit use with JDPA. Not surprisingly, Sun has some Java-based debuggers. And, most commercial debuggers that provide Java support use JDPA.
There are also a number of open-source Java debuggers, including one for the Eclipse (www.eclipse.org) project. Another is JSwat (www.bluemarsh.com/java/jswat/) from the Blue Marsh Softworks. It's a standalone Java-based debugger that can handle applications on various platforms because it uses the JDPA library.
JDPA sits below the view of most developers, yet it's still a very important component and key to Java's portability. It also gives developers choices that are unavailable through other development environments.