JavaFX 16 requires Visual C++ 2019 Redistributable on Windows?
thevenet.fred at free.fr
thevenet.fred at free.fr
Wed Apr 28 13:46:06 UTC 2021
Hi,
I am facing an issue where, after updating to JFX 16, an application fail to start on Windows machines where the
MS Visual C++ 2019 redistributable libraries are not installed, with the following exception:
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\binjr-3.0.2-SNAPSHOT_windows-amd64\runtime\bin\glass.dll: Can't find dependent libraries
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: C:\binjr-3.0.2-SNAPSHOT_windows-amd64\runtime\bin\glass.dll: Can't find dependent libraries
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.loadNativeLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.loadNativeLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.access$000(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication$1.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.<clinit>(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinPlatformFactory.createApplication(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinPlatformFactory.createApplication(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.run(Unknown Source)
... 7 more
As previously mentioned, the above exception is not thrown on machines where the Visual C++ 2019
redistributable is installed.
In more details, the application's package is built using OpenJDK 16 and OpenJFX 16 (x64).
I use jlink to build a runtime image that includes the javaFX modules (downloaded from Gluon[1]), and
launch the application from the classpath using this image (as the app itself is not modular).
An important thing to note, is that the issue does not arise when building the package using the same
process using JavaFX 15.
Also,I noticed that the issue does not arise either when I launch the application using the openJDK 16
built by Azul that includes JavaFX[2]. From there I tried substituting the "glass.dll" in my jlink-built runtime
for the onein the Azul distro, and, again, this works.
Using Dependancy Walker, I then confirmed that "glass.dll" as present in binairies linked on openjfx.io have
a dependency to VCRUNTIME140_1.DLL whereas the one built by Azul does not.
(Please note the "_1" above; to be quite clear both versions of the dll have dependency to vcruntime140.dll,
which is bundled with openJDK on Windows, but not vcruntime140_1.dll)
To be quite honest, I'm not sure this problem has its root in JavaFX's source code or if it is specific to the JavaFX
binaries built by Gluon or the way I build my application package.
Thanks in advance for your insights.
-- Fred
[1] [ https://gluonhq.com/download/javafx-16-jmods-windows/ | https://gluonhq.com/download/javafx-16-jmods-windows/ ]
[2] [ https://www.azul.com/downloads/zulu-community/?version=java-16-sts&os=windows&architecture=x86-64-bit&package=jdk-fx | https://www.azul.com/downloads/zulu-community/?version=java-16-sts&os=windows&architecture=x86-64-bit&package=jdk-fx ]
More information about the openjfx-dev
mailing list