Debugging Java applications
To debug Java™ programs, you can use the Java Debugger (JDB) application or other debuggers that communicate by using the Java Platform Debugger Architecture (JPDA) that is provided by the SDK for the operating system.
Information about problem diagnosis using Java can be found in Troubleshooting and support.
The Java Debugger
The JDB is included in the SDK. The debugger is started with the jdb command; it attaches to the JVM using JPDA.
- To debug a Java application:
-
- Start the JVM with the following options:
java -agentlib:jdwp=transport=dt_socket,server=y,address=<port> <class>
The JVM starts, but suspends execution before it starts the Java application.
- In a separate session, you can attach the debugger to the JVM:
The debugger will attach to the JVM, and you can now issue a range of commands to examine and control the Java application; for example, type run to allow the Java application to start.jdb -attach <port>
- Start the JVM with the following options:
- To debug Java applications running on remote workstations:
- JPDA uses a TCP/IP socket to connect to the remote JVM.
- Start the JVM with the following options:
java -agentlib:jdwp=transport=dt_socket,server=y,address=<port> <class>
The JVM starts, but suspends execution before it starts the Java application.
- Attach the debugger to the remote JVM:
jdb -attach <host>:<port>
- Start the JVM with the following options:
- For further information:
-
- For more information about JDB options, type:
jdb -help
- For more information about JDB commands:
- Type
jdb
- At the jdb prompt, type
help
- Type
- For more information about JDB and JPDA and their usage, see:
- For more information about JDB options, type: