|How to - set up eclipse development with open JFX Java > 8 [message #1822581]
||Tue, 10 March 2020 09:11
| Svenja Wendler
Registered: March 2020
|Was it helpfull to you?[ 1 vote ]|
|1.||yes|| 1 / 100%|
|2.||no|| 0 / 0%|
JavaFX is no longer a JRE component from Java 11
The first hurdle is already apparent when switching to Java 11, because JavaFX is no longer part of the JDK, either at Oracle or in the open source distribution OpenJDK. There are several solutions to this problem. One would be to use a JDK distribution that delivers Java 11 with JavaFX, such as Bellsoft's Liberica JDK. However, this article focuses on using e(fx)clipse and the OpenJFX SDK.
We use JavaFX in our YAKINDU products and have successfully and successfully converted the development of the GEF framework to the following configuration:
In the following we on the one hand convert our development environment to OpenJDK 11 with OpenJFX and e(fx)clipse, and then turn to the transition for our development, including compiler and launch configurations.
Transforming the development Environment
- We download and install a new Eclipse IDE, ideally for Eclipse committers.
- We upload OpenJDK 11 to any directory.
- We download OpenJFX SDK and store it in a directory.
- We install e(fx)clipse at least in version 3.6.0 in our Eclipse environment (Update-Site: https://download.eclipse.org/efxclipse/updates-nightly/site/).
- We finish Eclipse and insert the following lines below the "-vmargs" line into the eclipse.ini file ("---add-modules=ALL-SYSTEM" does not need to be re-inserted if already available):
Note: We adjust the path to the OpenJFX libraries according to the operating system and the location in the file system. We don't use quotation marks, even if the path contains spaces. Otherwise, the setting would be tacitly ignored. Furthermore, the path must not be terminated with a slash or backslash. The changes to the eclipse.ini must be made after the installation of e(fx)clipse, otherwise Eclipse will not start again.
If OpenJDK 11 is the only JDK installed, nothing else needs to be changed. If OpenJDK 11 is not installed, but is only unpacked or other Java versions are installed on the computer, then the following lines should also be inserted in the eclipse.ini directly above the "-vmargs" line:
/path/to/jdk-11.0.5+10/Contents/Home/bin (adapt to your directory)
Now let's start Eclipse again. We then install the end-user tools of GEF DOT via the eclipse release update site (for example, http://download.eclipse.org/releases/2019-06). These use JavaFX (and SWT integration) so we can check if our installation worked.
Possible source of error here are the settings in the eclipse.ini, which we should look again step by step.
If the IDE finally runs successfully with OpenJDK 11, OpenJFX 11 and e(fx)clipse, we now take care of the workspace and the runtime.
In order to change the trend, the following must be done:
- Set OpenJDK as JRE to use
- Ensure that this JRE is used as an execution environment
- Set the openjfx-libs folder in the e(fx)clipse preferences
These changes should compile the workspace. The following section describes these steps in more detail.
We set OpenJDK as a runtime environment in the Eclipse preferences. To do this, we select „Window → Preferences → Java → Installed JREs → Add ... and the path to the bin directory of the JDK.
We make sure that this JDK is applied to the execution environment we set. If necessary, we may remove all other JDKs to ensure that the OpenJDK is actually used.
We set the OpenJFX SDK in the preferences for e(fx)clipse. Above, we saved the OpenJFX SDK to a directory. Its lib directory must be in the Eclipse Preferences (Window → Preferences → JavaFX) JavaFX 11 + SDK. This should be the same path as before in the eclipse.ini. This setting makes your Eclipse aware of the JavaFX libraries for development.
Now everything is done to compile the workspace. If we want to start the application in the runtime, there is still a small thing to do.
We'll add the following VM arguments in the launch configuration; they are the same ones that we have previously entered in the eclipse.ini:
The procedure above should be used to switch existing Eclipse applications to OpenJDK 11 and OpenJFX 11 with e(fx)clipse.
Are there any comments or questions about this approach? We welcome any kind of feedback.
Powered by FUDForum
. Page generated in 0.02351 seconds