博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java remote debug(on startup)
阅读量:7146 次
发布时间:2019-06-29

本文共 1088 字,大约阅读时间需要 3 分钟。

If you use intellij, you can use the function "Attach to local process..." if it doesn't work then you need to set up a remote debug to connect to your remote program(can be on the same machine or actual remote machine).

 

Debugger side:

a. Create a new remote debug configure

b. Select "Socket", put localhost for local mahine or the actual host name if it's actual a remote host, host can be whatever as long as it's not occupied on remote host yet

c. Start the java program with options of below, normally use the first option, if you need to debug right on startup then you need to second option.

 

####remote debug####

-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8889

####remote debug on startup#####

  (Suspend=y which means program will suspend until connected to debugger, so debugger can execute right from the every beginnig of the program)

   -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=8889

 

 

e.g. java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8889 -cp . com.lefeng.MainClassName

转载于:https://www.cnblogs.com/glf2046/p/6207990.html

你可能感兴趣的文章