Listening for a JVM Suspended on a Thrown Exception

The debugger can listen for a target JVM that is suspended when a particular Java exception is thrown, to connect to the debugger. There are two ways to connect the target JVM to the debugger: via shared memory or a network socket.

Shared Memory

Shared memory has the fastest debugging performance if it is supported by your JVM platform. The debugger and the target JVM must be executing on the same computer.

JDK 1.6

jdk1.6/bin/java -agentlib:jdwp=transport=dt_shmem,address=javadebug,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe test.Test args

JDK 1.5

jdk1.5/bin/java -agentlib:jdwp=transport=dt_shmem,address=javadebug,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe test.Test args

JDK 1.4

j2sdk1.4/bin/java -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub test.Test args

JDK 1.3

jdk1.3/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,address=javadebug,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub test.Test args

Socket

A network socket can connect the debugger and the target JVM that can be running on the same computer or different computers.

JDK 1.6

jdk1.6/bin/java -agentlib:jdwp=transport=dt_socket,address=dbghost:8000,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe test.Test args

JDK 1.5

jdk1.5/bin/java -agentlib:jdwp=transport=dt_socket,address=dbghost:8000,onthrow=java.io.IOException,launch=d:/bin/debugstub.exe test.Test args

JDK 1.4

j2sdk1.4/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,address=dbghost:8000,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub test.Test args

JDK 1.3

jdk1.3/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=dbghost:8000,onthrow=java.io.IOException,launch=/usr/local/bin/debugstub test.Test args

©2001-2010. debugtools.com LLC. All rights reserved.