Attaching to a Java VM requires two procedures:
The following sections describe the options necessary for running a virtual machine in debugging mode. Full documentation of the options is available at http://java.sun.com/products/jpda/doc/conninv.html.
The following options are required to launch a VM for debugging.
Option | Description |
---|---|
-Xdebug | Enables debugging. |
-Xnoagent | Disables the sun.tools.debug agent so that the JPDA can attach its agent in a different manner. |
-Djava.compiler=NONE | Disables the JIT compiler. |
-Xrunjdwp:<JDWP sub-options> | Loads the JPDA reference implementation of JDWP. The suboptions are described in the following sections. |
If you are running the IDE on a Microsoft Windows system, use the following JDWP suboptions:
transport=dt_shmem,server=y,address=myapp,suspend=n
The address option specifies the name of the shared memory. The name can consist of any combination of characters, excluding the backslash. If these options do not work, try using the options described in the following section.
The following JDWP suboptions are suitable for all operating systems:
transport=dt_socket,server=y,address=8888,suspend=n
The address option specifies the port number.
Following are examples of commands that can be used to start a VM for debugging.
Microsoft Windows Systems
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,address=myapp,suspend=n -classpath C:\MyApplications\classes mypackage.MyApp
All Other Environments
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n -classpath $HOME/my_apps/classes mypackage.MyApp
![]() |
If you are attaching to an application that is running on an instance of the Classic VM, add -classic as the first option in the command. |
The remainder of the items in this dialog box depend on the debugger implementation and transport implementation you are using. See Attach Dialog Box for descriptions of the fields in the Attach dialog box.
See Also | |
---|---|
Debugging on a 64-Bit Java VM |