Important:
You can only attach to a Java Virtual Machine if you are debugging an
interpreted Java program. For High Performance Compiled (HPC) Java programs, you
must attach to a running process. For information about attaching
to a running process, please see the related task below.
You can attach to an already running Java Virtual Machine (JVM) if you start your Java application with one of the following commands:
java_g -debug yourapp
java -Xdebug -Djava.compiler=NONE -Xbootclasspath/a:<tools_jar_path>/tools.jar yourapp
where:
java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n -Djava.compiler=NONE yourapp
After running this command, you will see a line similar to the following:
Listening for transport dt_socket at address:4716
where
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=portnumber
where
When you start your application with one of these commands, an agent password or a port number is displayed.
Once your application is running and you have the agent password or port number, you can connect to the JVM from the debugger user interface or from the command line.
To attach to a running JVM from the debugger user interface:
To attach to a remote running JVM from the command line:
idebug -a0 -qhost=remotehost -qport=8000
To attach to a local running JVM from the command line:
Type idebug -a0 -password=agent_port_or_password -host=agent_host
where:
- hostname is the TCP/IP name or TCP/IP address of the machine running the JVM. If the host running the JVM and the machine running the debug engine are the same, use localhost as the hostname.
- -password=agent_password_or_port_number is either the password or the port number that is printed when you start your Java program using one of the commands mentioned above.
Attaching
to a local running process
Starting
the debugger for local debugging
Starting
the debugger for debugging compiled languages remotely
Starting
the debugger for debugging interpreted Java remotely