Remote debugging a Java application

前端 未结 6 1898
我在风中等你
我在风中等你 2020-11-22 07:24

I have a java application running on linux machine. I run the java application using the following:

java myapp -Xdebug -Xrunjdwp:server=y,transport=dt_socke         


        
6条回答
  •  耶瑟儿~
    2020-11-22 07:51

    Edit: I noticed that some people are cutting and pasting the invocation here. The answer I originally gave was relevant for the OP only. Here's a more modern invocation style (including using the more conventional port of 8000):

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

    Original answer follows.


    Try this:

    java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
    

    Two points here:

    1. No spaces in the runjdwp option.
    2. Options come before the class name. Any arguments you have after the class name are arguments to your program!

提交回复
热议问题