VS Code Remote Debugger
Configuring Remote Debugging in VSCode (in Dev Spaces)
This is a walkthrough of setting up the interactive debugger that connects to a Remote Program, such as a Web Container like Tomcat, JBoss EAP, IBM Websphere Liberty, or any other type of server that accepts remote connections. As long as the server you’re connecting to is listening, it will probably work.
Open the debugger menu on the left hand menu (it’s the Play icon with a bug at the bottom corner)
This Popup may appear if you’re running in Java Light mode. Pressing Yes enables more Java functionality and tooling, and will start compiling in the background.
Expand the Current File dropdown to add a new Config.
It creates a launch.json
file if one doesn’t already exists in your workspace. Click anywhere in the file and a context menu will open. Select the “Java: Attach to Remote Program” option.
Plug in the hostName and port into the configs like the following.
Start your Remote Server and and press the Play button in the debugger here to attach.
Now you can add breakpoints at critical areas, walkthrough/step into functions, check runtime variables, and all the other remote debugging features. Best of all, this works in DevSpaces too, so you really can have a one-stop shop for it all.