美文网首页工作生活
06_JDWP远程调试详解

06_JDWP远程调试详解

作者: leofight | 来源:发表于2019-07-02 20:50 被阅读0次

JDWP远程调试详解

JDWP:Java Debug Wire Protocol,Java调试协议

java -agentlib:jdwp=help查看帮助

               Java Debugger JDWP Agent Library
               --------------------------------

  (see http://java.sun.com/products/jpda for more information)

jdwp usage: java -agentlib:jdwp=[help]|[<option>=<value>, ...]

Option Name and Value            Description                       Default
---------------------            -----------                       -------
suspend=y|n                      wait on startup?                  y
transport=<name>                 transport spec                    none
address=<listen/attach address>  transport spec                    ""
server=y|n                       listen for debugger?              n
launch=<command line>            run debugger on event             none
onthrow=<exception name>         debug on throw                    none
onuncaught=y|n                   debug on any uncaught?            n
timeout=<timeout value>          for listen/attach in milliseconds n
mutf8=y|n                        output modified utf-8             n
quiet=y|n                        control over terminal messages    n

Obsolete Options
----------------
strict=y|n
stdalloc=y|n

Examples
--------
  - Using sockets connect to a debugger at a specific address:
    java -agentlib:jdwp=transport=dt_socket,address=localhost:8000 ...
  - Using sockets listen for a debugger to attach:
    java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y ...

Notes
-----
  - A timeout value of 0 (the default) is no timeout.

Warnings
--------
  - The older -Xrunjdwp interface can still be used, but will be removed in
    a future release, for example:
        java -Xdebug -Xrunjdwp:[help]|[<option>=<value>, ...]




服务端执行如下命令

➜  Desktop java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5050 -jar spring_lecture-1.0.jar 
Listening for transport dt_socket at address: 5050

客户端配置

debug启动即可进入断点。

相关文章

网友评论

    本文标题:06_JDWP远程调试详解

    本文链接:https://www.haomeiwen.com/subject/cmjicctx.html