Home > Software design >  How to change Java Debug Arguments in vscode launch.json config?
How to change Java Debug Arguments in vscode launch.json config?

Time:12-02

I configure launch.json to launch Java debugger and working successfully. After a short while, I see error ERROR: transport error 202: recv error: Connection reset by peer. I did google it, and it was suggested to change the debug argument from:

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

to:

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

The debug arguments above are auto generated by vscode. How I can change it? I didn't find a way to configure such argument. The only option is to configure a task to run the command, and configure a debug option to run the task to launch the debugger and attached to that debugger session.

I am checking if there is a way to change the part to server=y as it is much easier.

CodePudding user response:

Sorry for hijacking your question :D I suppose this is just better place to discuss it. From the previous discussion:

SO seems to have these answers. I never tested them myself though.

If it helps, one of the SO questions, and a comment here, has a link to the VSCode configuration reference, https://code.visualstudio.com/docs/java/java-debugging#_attach . There you can see the attach request options.

My understanding of the attach vs launch is that

  • launch runs your App, and then automatically attaches a debugger to it.
  • attach is used only in cases where you have an already running JVM, lets say on some remote server, and you want to debug it.

How are you running starting your JVM? My guess would be that if you are starting the JVM from terminal, then put the server=y option there. If you want the VSCode to run the JVM, which I assume is the case, then the launch request is what you want.

Did I understand your issue correctly?

  • Related