Java command-line options to run a debuggee

For remote debugging, you need to start the Java application to be debugged (debuggee) as a server using the following command:

java -Xdebug -Xnoagent
-agentlib:jdwp=transport
-Xdebug

Enables debugging.

-Xnoagent

Disables the old Sun.tools.debug agent. This is the default value.

-agentlib:jdwp=sub-options

sub-options are specified in the following format:

name1[=value1],name2=[=value2]...

The sub-options are as follows:
transport

Indicates the name of the transport. The value is dt_socket, and by default, NSJ 11 uses dt_socket.

server=y

y means listen for a debugger application

address= transport-address-for-this-connection

The transport address is the port number in which the debuggee is listening for the debugger or a range of port value from which the debuggee selects the first available port to listen for the debugger. The following syntax is used:

address=[<name>:]<port> | <start port>-<end port>

where,

<name> is the host name.

<port> is the socket port number.

<start port> is the starting port number for a range of ports.

<end port> is the ending port number for a range of ports.

suspend=y suspends the debuggee just before the main class loads.

Optionally, you can specify the -Xint argument, by using only the interpreter and not the HotSpot compiler.

NOTE:

Specifying a range of port numbers for address is specific to NonStop.

The subsequent examples show the various ways in which the connection address is specified:

When the port number is specified

java -Xdebug -Xnoagent

-agentlib:jdwp=transport=dt_socket,server=y,address=4000,

suspend=y classname arguments

When the range of ports are specified and hostname is implicit

java -Xdebug -Xnoagent

-agentlib:jdwp=transport=dt_socket,server=y,address=4000-4050,

suspend=y classname arguments

When the machine name and port range are specified

java -Xdebug -Xnoagent

-agentlib:jdwp=transport=dt_socket,server=y,address=someMachine:4000-4050,

suspend=y classname arguments