When you debug a Java application, at least two virtual machines (VMs)
must be running. One VM runs the IDE, and the other VM runs the application
being debugged. If you start a debugging session by using the Debug Start command,
the IDE runs the second VM for you.
If you start a debugging session by using the Debug
Attach command, you must explicitly launch the second VM.
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/j2se/1.3/docs/guide/jpda/conninv.html.
The following options are required to launch a VM for debugging.
Option | Description |
---|---|
-classic | Required for the JavaTM 2 Platform, Standard Edition, v. 1.3.1 or earlier. |
-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: |
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 SystemsFor the J2SE platform v. 1.3.0:
java -classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,address=myapp,suspend=n -classpath C:\MyApplications\classes mypackage.MyApp
For the J2SE platform v. 1.3.1:
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,address=myapp,suspend=n -classpath C:\MyApplications\classes mypackage.MyApp
All Other EnvironmentsFor the J2SE platform v. 1.3.0:
java -classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n -classpath $HOME/my_apps/classes mypackage.MyApp
For the J2SE platform v. 1.3.1:
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n -classpath $HOME/my_apps/classes mypackage.MyApp
Once you start a VM in debugging mode, you can attach the IDE debugger to it.
The remainder of the items in this dialog box depend on the debugger implementation and transport implementation you are using. See Attach to VM Dialog Box for descriptions of the fields in the Attach to VM dialog box.
See also | |
---|---|
The Debug Environment |