JavaFX 11 samples to run from Eclipse with different options and build tools
Version Eclipse: 2018-12 (4.10.0)
Download an appropriate JDK 11 for your operating system. Make sure JAVA_HOME
is properly set to the Java 11 installation directory.
Note: If you get this message when you add JDK 11:
You selected a JRE that this version of Eclipse JDT does not yet support fully. Some of the features may not work as expected.
then install this patch from MarketPlace: Java 11 support for Eclipse 2018-09 (4.9)
.
For the first time only:
-
Make sure you have the Buildship Gradle Integration 3.0 plugin installed. Update to 3.0.0 version from this URL.
-
Add
org.gradle.java.home
to agradle.properties
file, with the path to JDK 11, andpath.to.fx.mods
to agradle.properties
file, with the path to JDK jmods. This file can be part of the project or under the gradle user homeUSER_HOME/.gradle
. -
Add the
JavaFX11
library to the modulepath of the project.
Clone the sample, open it with Eclipse and refresh the Gradle project.
Run from Gradle Tasks -> application -> run
.
Run from Gradle Tasks -> other -> jlink
to create a custom runtime.
On Linux or Mac run:
build/hellofx/bin/java -m hellofx/org.openjfx.MainApp
On Windows, run:
build\hellofx\bin\java -m hellofx/org.openjfx.MainApp