Building for Java SE

From an application (marked as “Application Block”) and its contained building blocks you can automatically generate an executable project. Code that you wrote manually within the building blocks is copied into the project, the rest is generated automatically.

Note that the result is an Eclipse project, by default marked with a suffix _exe. This project is, once generated, completely independent from the Reactive Blocks SDK.

Starting the Build Process

Open the «application» building block that you want to generate code for, right-click and select Build in its context menu. Further, choose Select Build Target Platform… to open a dialog displaying all platform choices, e.g., J2SE, OSGi (see the next section). If the system was build before and you made changes to it, you will also see an option to rebuild the system for a specific target platform.

alt text

Another way to generate executable code is from the context menu of an application block listed in the Block view. You will find the same build menu as above.

alt text

Deployment

You need to be online and signed in in order to implement a system. If you haven’t done so, you will be prompt to login.

Thereafter, a dialog will ask which code generator to be used to realize the application.

alt text

In the next dialog you can choose the logging framework and level you want to use and also change the project name of the generated system. Libraries that are used in the building block can be copied as jar-files or extracted so that you get also Java codes in the generated system.

alt text

The Result

An executable project is generated automatically. You can find it highlighted in the Java Package Explorer. This highlight will disappear after some time.

alt text

Running an Executable Project

You can run the generated project by choosing Run As from the context menu of the *.launch file inside the project. Then, choose the first option as shown below.

alt text

Troubleshooting

Projects cannot be deleted

The code generator deletes the previously generated project. If your are executing an application, it may be that jar files are locked by the JVM and deleting these projects fails if you generate them again.

  • Terminate all running Java applications that you generated and started previously.
  • Try to manually delete the generated project.
  • Build again.

Java application does not start

The generated project is a pure Java project, independent of Reactive Blocks, so you can in principle treat it like any other Java project.

Check the classpath of the project.

  • Right-click the generated _exe project.
  • Select Build Path / Configure Build Path…
  • Check in all tabs if the classpath is defined correctly.

If you observe the exception java.lang.UnsupportedClassVersionError: ..., the compiler compliance level for the executable project is probably higher than the JRE your eclipse is using. There are several ways to solve this. One of them is to change the JRE used in the project. Open the Build Path configuration as described above. Open tab Libraries and edit the JRE System Library entry, choose a later version. Alternatively, you can change the default JRE for your entire workbench as described in this guide.