debug Java进程的debug参数

前几天给java应用设置debug参数,发现有两个参数:-agentlib:jdwp 和 -Xrunjdwp,根据官方文档记录,区别如下:

 

 

Sun's VM implementations require command line options to load the JDWP agent for debugging. From 5.0 onwards the -agentlib:jdwp option is used to load and specify options to the JDWP agent. For releases prior to 5.0, the -Xdebug and -Xrunjdwp options are used (the 5.0 implementation also supports the -Xdebug and -Xrunjdwp options but the newer -agentlib:jdwp option is preferable as the JDWP agent in 5.0 uses the JVM TI interface to the VM rather than the older JVMDI interface).

-Xrunjdwp

This option loads the JPDA reference implementation of JDWP. This library resides in the target VM and uses JVMDI and JNI to interact with it. It uses a transport and the JDWP protocol to communicate with a separate debugger application.

 

-agentlib:jdwp

Loads the JPDA reference implementation of JDWP. This library resides in the target VM and uses JVM TI and JNI to interact with it. It uses a transport and the JDWP protocol to communicate with a separate debugger application. Specific sub-options are describedbelow.

eg.: -agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=y

猜你喜欢

转载自yueyemaitian.iteye.com/blog/2320245