Attaching to an Executing JVM
The target JVM can be invoked and can start executing. Later the debugger can
attach to
the executing target JVM. There are two ways to attach the debugger to the target JVM:
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 must be executing on the same computer.
The user-specified address parameter is optional -- if not specified, then the target JVM
will print out the shared memory address that it will use.
JDK 1.6
jdk1.6/bin/java -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n,address=javadebug test.Test args
JDK 1.5
jdk1.5/bin/java -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n,address=javadebug test.Test args
JDK 1.4
j2sdk1.4/bin/java -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=javadebug test.Test args
JDK 1.3
jdk1.3./bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=javadebug test.Test args
Socket
A network socket can connect the debugger and the target JVM that can be running on the same
computer or on different computers.
The user-specified address (port number) parameter is optional --
if not specified, then the target JVM
will print out the port number that it will use.
JDK 1.6
jdk1.6/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 test.Test args
JDK 1.5
jdk1.5/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 test.Test args
JDK 1.4
j2sdk1.4/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 test.Test args
JDK 1.3
jdk1.3/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 test.Test args
©2001-2010. debugtools.com LLC. All rights reserved.