In Java 11, JavaFX was removed from the SDK. It is now in its own separate module, and if you want to use it in your application you will need to specifically include it.
Where can I get the JavaFX SDK from?
How do I include it in a modular application?
If you are running a modular Java application from the command line, you need to add the JavaFX module to the classpath.
I have tested this with our Java PDF Library JPedal, as the Viewer has some features which require JavaFX. The command I used is:
java --module-path "path/to/javafx-sdk-11/lib" --add-modules=javafx.controls --add-modules=javafx.swing -jar "path/to/jpedal.jar"
In the example above:
–module-path “path/to/javafx-sdk-11/lib” adds the JavaFX SDK to the module path.
–add-modules=javafx.controls –add-modules=javafx.swing adds the specific JavaFX modules needed to run the application. JPedal requires the controls module and the swing module, so those are the 2 I have added. The list of the available modules can be found in the documentation here.
The good thing about modularisation is that you only use the bits you need to run your application. You don’t need the whole JavaFX SDK if you are not using the all the modules. So you end up with a smaller, more lightweight program.
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.