I\'ve got an application on Java 8 + JavaFX that I want to migrate to Java 11. The basis aim is to give a .jar to users on a network and so they can use this little applicat
You may also use:
System.setProperty("java.library.path", "path/to/javafx-sdk-11.0.x/lib");
Where path/to/javafx-sdk-11.0.x/lib
is the path to the JavaFX's lib (or for Windows, bin
) directory.
Note this technique will work if the JavaFX Application is launched from a secondary class. Launching a JavaFX application directly from it's own class requires the module system (e.g. module-info.java
, etc.) since JDK9.
On Windows, updated PATH variable to contain javafx-sdk-11/bin.
It should also be noted that if you are using Eclipse (Which I know you are not in this case) and Maven, adding dependencies for the platform specific javafx-graphics libraries (win, mac, linux) will cause this issue if you try to build through maven. I'm not entirely sure why.
I was banging my head against a wall trying to just do a clean javafx:run in the goals before I just removed the platform dependent dependencies in the pom and it finally ran.
So, there are some missing librairies.
On Windows, the missing DLL from javafx-sdk-11/bin are at least prism_d3d.dll, prism_sw.dll, javafx_font.dll, glass.dll; you can put all into the jdk directory C:\Program Files\Java\jdk[...]\bin
(It's not the best solution), or into the jlink directory for a custom JRE, inside .[...]\jlink\bin\
On Linux, the missing .so from javafx-sdk-11/lib are at least libprism_es2.os, libprism_sw.so, libglass.so, libglassgtk3.so (and libglassgtk2.so probably too for old configuration), libjavafx_font.so, libjavafx_font_freetype.so, libjavafx_font_pango.so; you can put all into the /usr/lib/jvm/java-11[...]/lib
for example (It's not the best solution), or into the jlink directory for a custom JRE, inside [...]/jlink/lib
.
On Mac, the missing .dylib from jav javafx-sdk-11/lib must be (I suppose!) libprism_es2.dylib, libprism_sw.dylib, libglass.dylib, libjavafx_font.dylib [To confirm].
To use the jlink, you should use the jmods - no need to use the librairy files.
And my module-info.java was not really complete:
module AutoGeneratorOpenData {
requires sqlite.jdbc;
requires javafx.controls;
requires javafx.graphics;
requires java.sql;
requires java.desktop;
requires javafx.fxml;
requires javafx.base;
exports autogeneratoropendata;
exports autogeneratoropendata.controller;
exports autogeneratoropendata.model;
exports autogeneratoropendata.util;
opens autogeneratoropendata.controller;
}
Now it's working.