Java Programming

Last update: Edit

1 Introduction

With Java actions, you can extend the functionality of your application in situations where it would be hard to implement this functionality in microflows.

For information about Java actions in the Modeler, see Java Actions.

2 Writing Code in the .java Files of Your Java Actions

In the java files of your Java actions, you can write your Java code between the markers:


This is explained in more detail below.

The other code in these files is regenerated each time when you deploy your model, thus any modifications that you make in them will be overwritten. However, your imports will be preserved.

The method executeAction is called by the Runtime when the Java action is being executed. Between the lines // BEGIN USER CODE and // END USER CODE, you can write your custom code that will always be called when executing the action. In this method, you can call other methods in the section between // BEGIN EXTRA CODE and// END EXTRA CODE.

The executeAction method throws all exceptions that occur. This means you can do error handling in the microflow calling this Java action. If you would like to do your own error handling within the action, use try/catch statements.

3 Using the Mendix Java library

In the Java code that you write for your Java actions, you can use the Mendix Java library.

This library is automatically added to your libraries when you imported your project into Eclipse, and it is called mxruntime.jar.

For details on usage and example, see How to Use the Java API.

4 Using Eclipse as an Environment to Write Your Mendix Java Actions

For details on this topic, see Using Eclipse.

5 Main Documents in This Category