Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
Creating a new Java project for Windows using Eclipse


This manual shows how to setup a Java project on Eclipse running on Microsoft Windows which uses the MLPI to communicate with the target device. Please note, that it is not possible to run your Java program on the device target, as there is no Java runtime available. If you want to program an application which is also running on your target device, then you have to stick to the mlpiCore Toolbox for C/C++ and the Workbench OEM which is also Eclipse-based.


To start programming in Java, you need a working Java environment. By default, this includes:

  • Java SE (runtime environment), to run Java applications.
  • Java JDK (Java developing environment), to compile Java applications.
  • Eclipse for Java developers (Integrated Development Environment), to edit your code.

The Java downloads can be found at oracle and are courtesy of oracle: Please install also the 32-bit version, because the MLPI currently only supports 32-bit applications. Of course, it is possible to run your application also on 64-bit operating systems. Eclipse can be downloaded at You can choose between 32bit and 64bit version. For this tutorial, "Eclipse for Java Developers - Juno(4.2)" has been used. But older versions of Eclipse(3.6) have also been successfully tested.

Creating a new Java project

Start by creating a new Java project in your workspace:


Please make sure that you choose the 32-bit version under "Use an execution environment JRE". By clicking Configure JRE, you can see further details:


If a 32-bit edition of the JRE is not listed, then make sure you already installed the JRE as listed above and try to add it to the list manually, by clicking the Search... or Add... button. Java version 8 is successfully supported by the MLPI.

To use the MLPI with Java, you need to add the javamlpi.jar package which can be found in the folder mlpi4Java/lib/... . Add the library as shown in the screenshots below. If you want to add the MLPI to an existing project, then you can do this by right-clicking the project root and selecting Properties. In the list box under Java Build path, you can find the Libraries tab where you can add the javamlpi.jar. It is always recommended to add the library "as a link".


The library is shown under Referenced Libraries in the Package Explorer.


Now, lets add a new class to your project under the src folder by using File->New->Class.


Insert the following MLPI code to connect to a device and read some data. Replace the IP with the IP address of your device.

public class MlpiSample {
public static void main(String[] args) {
MlpiConnection connection = new MlpiConnection();
// try to connect
connection.connect(" -user=mlpiTest -password=mlpiTest");
// read some interesting informations
System.out.println("FirmwareVersion: " + connection.system().getVersionInfo("VERSION_FIRMWARE"));
System.out.println("CurrentMode: " + connection.system().getCurrentMode().toString());
System.out.println("CPULoad: " + connection.system().getCpuLoad());
System.out.println("CPULoadMax: " + connection.system().getCpuLoadMax());
System.out.println("OperationHours: " + connection.system().getOperationHours());
System.out.println("Language: " + connection.system().getLanguage());
System.out.println("Name: " + connection.system().getName());
System.out.println("IpAddress: " + connection.system().getIpAddress());
System.out.println("SubnetMask: " + connection.system().getSubnetMask());
System.out.println("Gateway: " + connection.system().getGateway());
System.out.println("SerialNumber: " + connection.system().getSerialNumber());
System.out.println("Diagnosis: " + connection.system().getDisplayedDiagnosis().text);
System.out.println("NewestDiagnosisIndex: " + connection.system().getNewestDiagnosisIndex());
System.out.println("OldestDiagnosisIndex: " + connection.system().getOldestDiagnosisIndex());
Diagnosis[] log = connection.system().getDiagnosisLog(connection.system().getNewestDiagnosisIndex(), connection.system().getNewestDiagnosisIndex()-connection.system().getOldestDiagnosisIndex());
for (Diagnosis diagnosis : log) {
System.out.println(" *"
+ " " + diagnosis.index
+ " " + diagnosis.number
+ " " + diagnosis.dateTime.hour + ":" + diagnosis.dateTime.minute +":" + diagnosis.dateTime.second
+ " " + diagnosis.state
+ " " + diagnosis.text

For the last step, you have to add the path of the mlpijavawin32.dll to the search path of the Java virtual machine. In Eclipse, you can do this as a Java VM argument under "Run Configurations->Java->Main->Arguments->VM Arguments:"

For example: -Djava.library.path="c:\Program Files\Rexroth\MLPI-SDK_01VRS\mlpi4Java\bin\..." Later on, when you deploy your Java application, you have to include this DLL in the same folder as your Java application. Otherwise, or if you path is not correct, you will get UnsatisfiedLinkerErrors.


Click "Run" to start your application. Happy coding...