Before Java 5.0, use -Xdebug
and -Xrunjdwp
arguments. These options will still work in later versions, but it will run in interpreted mode instead of JIT, which will be slower.
From Java 5.0, it is better to use the -agentlib:jdwp
single option:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044
Options on -Xrunjdwp
or agentlib:jdwp
arguments are :
transport=dt_socket
: means the way used to connect to JVM (socket is a good choice, it can be used to debug a distant computer)
address=8000
: TCP/IP port exposed, to connect from the debugger,
suspend=y
: if 'y', tell the JVM to wait until debugger is attached to begin execution, otherwise (if 'n'), starts execution right away.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…