Debugging Java

0
When I first started with Mendix (not that long ago), it was quite simple to debug java code. Create the Java action, deploy for eclipse, open the directory in eclipse and debug. The debugger would run the app, allow stepping through code and show all variables as expected. However I’ve been trying to do this more recently and keep having problems. The app won’t run in eclipse, or it runs but won’t step through code or it steps through code but won’t show variables. There’s the option of remote debugging, but that doesn’t really work any better. I feel like there are all sorts of issues with different versions of java, even though I have tried to standardise on v11. Searching the forum shows that I’m not alone. What is everybody else doing? Is there a way of using VS Code for debugging instead?
asked
1 answers
0

I use VS Code for debugging my Mendix Java Actions.

I set up my Mendix Studio Pro for remote debugging as you would do for Eclipse. It’s step 2 in this link.
https://docs.mendix.com/howto/monitoring-troubleshooting/debug-java-actions-remotely/

In VS Code I installed the “Debugger for Java” extension from Microsoft. I then created a launch.json file for this to allow me to connect to a running Studio Pro session.
 

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Launch Current File",
            "request": "launch",
            "mainClass": "${file}"
        },
        {
            "type": "java",
            "name": "Remote Mendix",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005
        }
    ]
}

When I go into the Run and Debug menu I will now have two options to choose from. I use “Remote Mendix” then Start Debugging. This will connect to a running Studio Pro and you can now debug your Java Actions.

I hope this helps.

 

answered