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).
- Download JavaFX jmods for your operating system and unzip to a desired location.
Clone the sample and open the project with Eclipse.
Note: For Eclipse lower than 2018-12, the JavaFX required jars
(javafx.base, javafx.graphics, javafx.controls and javafx.fxml) have been directly added
to the module path (Run -> Run Configurations... -> Java Application -> Dependencies).
Run with Run configurations -> Java Application -> modHelloFX
To create and run a custom JRE, from terminal:
On Linux or Mac run:
cd IDE/Eclipse/Modular/Java/HelloFX
export PATH_TO_FX_MODS=path/to/javafx-jmods-11.0.2
$JAVA_HOME/bin/jlink --module-path $PATH_TO_FX_MODS:bin/hellofx --add-modules=hellofx --output jre
jre/bin/java -m hellofx/org.openjfx.MainApp
On Windows run:
cd IDE\Eclipse\Modular\Java\HelloFX
set PATH_TO_FX_MODS="path\to\javafx-jmods-11.0.2"
jlink --module-path "%PATH_TO_FX_MODS%;bin\hellofx" --add-modules=hellofx --output jre
jre\bin\java -m hellofx/org.openjfx.MainApp