How do attach to a remote Java debugger using Visual Studio Code

試著忘記壹切 提交于 2019-12-11 00:16:25

问题


I am trying to configure Visual Studio Code so that I can use it instead of IJ for debugging a complex Java app. Because of reasons too complicated to get into, I have been running on a terminal using mvnDebug then connecting using JDB. In IJ I set this up as a remote debugger, however, I can't seem to find the same option in VSC.

I have tried this extension, but I can't figure out how to configure it for just JDB (I shouldn't need startupClass etc).

How do I use JDB with Visual Studio Code?


回答1:


Create a Debug Configuration like below and press F5 to debug :

"version": "0.2.0",
"configurations": [
    {
        "type": "java",
        "name": "Debug (Attach)",
        "projectName": "Your_Project_Name",
        "request": "attach",
        "hostName": "your_host_name",
        "port": Debugging_port
    }
]

Example :

"version": "0.2.0",
"configurations": [
    {
        "type": "java",
        "name": "Debug (Attach)",
        "projectName": "MyApplication",
        "request": "attach",
        "hostName": "localhost",
        "port": 8787
    }
]

I am using wildfly server. So the default debugging port is 8787.



来源:https://stackoverflow.com/questions/44372595/how-do-attach-to-a-remote-java-debugger-using-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!