Mendix: How to debug javaaction with IntelliJ and VS Code
- Hank
- 14 Jul, 2024
Sometimes, you may want to debug the Java actions in Mendix project. In the Mendix Documentation, it only shows how to debug Java actions with Eclipse. But for those who are using IntelliJ or VS Code, how to do that?
In this post, I will show you how to debug Java actions in Mendix project with IntelliJ and VS Code.
Debug Java action with IntelliJ
- Open the Mendix project in Mendix Studio Pro
- Goto you App settings, double click your app configuration.
- In the
Server
tab, input-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
in theExtra JVM parameters
field. This will enable the remote debug mode for the Mendix project. - Open the Mendix Project in IntelliJ
- Open the debug configuration, click the
+
icon to add a new configuration, selectRemote JVM Debug
in the popup window. - Make sure the parameters in
host
andport
are the same as theaddress
in the Mendix project settings. and alsoCommand line arguments for remote JVM
should be same as theExtra JVM parameters
in the Mendix project settings. - Click
Apply
andOK
to save the configuration. - In the Mendix Studio Pro, click the
Run
button to start the project. - Now you can set breakpoints in the Java action code, and click the debug button to start the debug session.
Debug Java action with VS Code
- Keep the Mendix project settings as the same as the IntelliJ settings.
- Open the Mendix project in VS Code
- Install the
Java Extension Pack
in the VS Code - Open the debug panel in VS Code, click the
Add Configuration
button, selectJava: Attach to Remote Program
in the popup window. - Make sure the
host
andport
are the same as theaddress
in the Mendix project settings. and alsoCommand line arguments for remote JVM
should be same as theExtra JVM parameters
in the Mendix project settings.{ "type": "java", "name": "Mendix Remote Debug", "request": "attach", "hostName": "localhost", "port": 5005 }
- Click
Apply
andOK
to save the configuration. - In the Mendix Studio Pro, click the
Run
button to start the project. - Now you can set breakpoints in the Java action code, and click the debug button to start the debug session.