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. 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:

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:

  1. Select Attach from the File menu. The Attach dialog appears.
  2. Click on the Interpreted tab.
  3. Select the type of connection for the attach from the dialog.
  4. Enter the required parameters for the type of connection.
  5. Click Attach to attach to the JVM and dismiss the dialog.

To attach to a remote 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_or_port_number


    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=8000

To attach to a local running JVM from the command line:

Type idebug -a0 -password=agent_port_or_password -host=agent_host

where:

[Related Concepts]
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 debugging compiled languages remotely
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)Starting the debugger for debugging interpreted Java remotely

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