Debug Java Actions

Last update: Edit

1 Introduction

Mendix Studio Pro has a built-in debugger to solve errors on the microflow level. A microflow can be extended with custom Java actions, but because these actions are text-based, they can only be checked on compile errors. If you run into an error in any of the Java actions, you can easily debug them by utilizing the debugger of Eclipse.

This how-to will teach you how to do the following:

  • Set breakpoints
  • Debug in Eclipse

2 Prerequisites

Before starting this how-to, make sure you have completed the following prerequisites:

  • Install Eclipse
  • Add a Java action and open the app in Eclipse
  • Read How to Extend Your Application with Custom Java
  • Deploy the application for Eclipse by selecting Deploy for Eclipse from the app menu in Studio Pro (you should redo this every time you make changes in Studio Pro):

3 Setting Breakpoints

  1. Open Eclipse and locate the app in the Package Explorer.
  2. Double-click
  3. Place the cursor on the line that needs debugging, hold down Ctrl+Shift, and press B to enable a breakpoint. A blue dot in front of the line will appear:

4 Debugging in Eclipse

  1. Select the app root node in the package explorer and click the debug icon in the Eclipse toolbar:

    The application will now be started with Eclipse attached as debugger.

  2. As soon as the deployment process is ready, open the application in your browser and trigger the Java action:

    • As an end-user of the application, you will see a progress bar on your application
    • As a developer, you will see the Eclipse icon flashing on the Windows task bar
  3. Open Eclipse. You should now see the “debug” perspective of Eclipse.

  4. Click Step into (or press F5) or Step over (or press F6) to move on the next step in the microflow:

  5. Place your cursor on any of the variables in the Java action to see its value in a pop-up window:

5 Read More