If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.

Debug Java Actions

Last modified: August 19, 2024

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 teaches you how to do the following:

  • Set breakpoints
  • Debug in Eclipse

Prerequisites

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

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

Setting Breakpoints

  1. Open Eclipse and locate the project in the Package Explorer.

  2. Double-click ReverseCustomerName.java:

  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:

Debugging in Eclipse

  1. Select the project 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:

Read More