Attaching to a running Java Virtual Machine

ngjava.gif (225 bytes)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. See the related topic below on how to attach to a running process.

You can attach to an already running Java Virtual Machine (JVM) if you run your Java application with the java_g -debug command. When you start your application with the java_g -debug command, an agent password is displayed. Take note of this password because it will be needed to attach to the running JVM.

Once your application is running and you have the agent password, 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:

  1. Select Attach JVM from the File menu. The Attach to Java Virtual Machine dialog appears.
  2. Select the type of connection for the attach from the dialog.
  3. Enter the required parameters for the type of connection.
  4. Click Attach to attach to the JVM and dismiss the dialog.

To attach to a running JVM from the command line:

  1. Start the debug engine daemon for the host JVM using the irmtdbgj command with the JVM attach parameters. If you are debugging remotely, remember to use the engine daemon parameters as well. For example:

    irmtdbgj -qhost=workstation_id -quiport=8001 -host=hostname -password=agent_password


    Where:

  2. Start the debugger interface in attach mode. Use a process_id of 0 for the -a parameter when attaching to a JVM. If you are debugging remotely, remember to use the remote debug parameters as well. For example:

    idebug -a0 -qhost=remotehost -qport=8001

 

[Related Concepts]
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)When to attach

Related Tasks
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)Attaching to a local running process
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)Starting the debugger for local debugging
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)Starting the debugger for remote debugging

Related References
idebug command
ngjava.gif (225 bytes)irmtdbgj command