JDK-8281089 : JavaFX built with VS2019 and jlinked into JDK 11.x fails to start
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: openjfx11,openjfx17
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-02-01
  • Updated: 2022-07-07
  • Resolved: 2022-02-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx11.0.15Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Description
To reproduce this, run the following on a Windows machine that does *not* have the Visual Studio runtime libraries installed in C:\Windows\System32. In particular, make sure that C:\Windows\System32\vcruntime140_1.dll does not exist.

1. Use a JDK 11.0.x release built with VS 2017

2. Use a recent version of the JavaFX jmods  built with VS 2019 (e.g., JavaFX 17.0.2)

3. Create a jlinked image as follows:

$ jlink --module-path ./javafx-jmods-17.0.2 --add-modules java.se,javafx.controls --bind-services --output ./jdk-11+fx

4. Run any JavaFX program using the custom. jlinked JDK:

$ jdk-11+fx/bin/java -Djavafx.verbose=true -Dprism.verbose=true HelloRectangle

BUG: it will print the following exceptions and fail to start:

JavaFX launchApplication method: launchMode=LM_CLASS
Loaded jdk-11+fx\bin\api-ms-win-core-console-l1-1-0.dll from java.library.path
Error: failed to load api-ms-win-core-console-l1-2-0.dll : java.lang.UnsatisfiedLinkError: no api-ms-win-core-console-l1-2-0 in java.library.path: 
...
Loaded jdk-11+fx\bin\vcruntime140.dll from java.library.path
Error: failed to load vcruntime140_1.dll : java.lang.UnsatisfiedLinkError: no vcruntime140_1 in java.library.path: 
Loaded jdk-11+fx\bin\msvcp140.dll from java.library.path
...
GraphicsPipeline.createPipeline failed for com.sun.prism.d3d.D3DPipeline
java.lang.UnsatisfiedLinkError: jdk-11+fx\bin\prism_d3d.dll: Can't find dependent libraries
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
	at java.base/java.lang.System.loadLibrary(System.java:1867)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:166)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
	at javafx.graphics/com.sun.prism.d3d.D3DPipeline.lambda$static$0(D3DPipeline.java:54)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:50)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:92)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
	at java.base/java.lang.Thread.run(Thread.java:834)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
Loaded jdk-11+fx\bin\prism_sw.dll from java.library.path
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
JavaFX: using com.sun.javafx.tk.quantum.QuantumToolkit
Error: failed to load api-ms-win-core-console-l1-2-0.dll : 
Error: failed to load vcruntime140_1.dll : java.lang.UnsatisfiedLinkError: no vcruntime140_1 in java.library.path: 
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: jdk-11+fx\bin\glass.dll: Can't find dependent libraries
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:301)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:293)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
	... 5 more
Caused by: java.lang.UnsatisfiedLinkError: jdk-11+fx\bin\glass.dll: Can't find dependent libraries
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
	at java.base/java.lang.System.loadLibrary(System.java:1867)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:166)
	at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:54)
	at javafx.graphics/com.sun.glass.ui.Application.loadNativeLibrary(Application.java:112)
	at javafx.graphics/com.sun.glass.ui.Application.loadNativeLibrary(Application.java:120)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.access$000(WinApplication.java:43)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:107)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:88)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.<clinit>(WinApplication.java:88)
	at javafx.graphics/com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:39)
	at javafx.graphics/com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:36)
	at javafx.graphics/com.sun.glass.ui.Application.run(Application.java:146)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:291)
	... 10 more

Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jfx17u/pull/37 Date: 2022-02-28 16:14:18 +0000
28-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jfx11u/pull/75 Date: 2022-02-28 16:02:42 +0000
28-02-2022

Changeset: e74cbe8b Author: Kevin Rushforth <kcr@openjdk.org> Date: 2022-02-28 13:36:50 +0000 URL: https://git.openjdk.java.net/jfx/commit/e74cbe8b9563a1ab1a21290aa125579bdaa2f29f
28-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jfx/pull/734 Date: 2022-02-16 16:46:47 +0000
16-02-2022

The root cause of this problem is that in the jmods, all of the DLLs from the javafx.* modules end up in the same place as the DLLs from the JDK, which caused a conflict as reported in JDK-8207015. For the Microsoft DLLs, it meant that both java.base and javafx.graphics were trying to install some of the same files into the same place, which caused a jlink error, so I filed JDK-8207015, and I fixed it by removing the Microsoft DLLs entirely from javafx.graphics.jmod. This works only if the JDK distributes the same (or later) version of Microsoft DLLs as JavaFX does. Since JDK 11.x is built with VS 2017, this will fail when installing a version of JavaFX built with VS 2019. One possible solution would be to create a JavaFX-specific subdirectory for the DLLs. We want to first find this in mainline jfx first (since we already hit the problem and it could pop up again in some later version of JavaFX), and then backport it to jfx17u and jfx11u.
01-02-2022

This bug was initially discussed while evaluating the fix for JDK-8207015, but at the time we didn't file a follow-on bug. We are now looking into backporting the Windows Visual Studio 2019 compiler update to JavaFX 11.x, and this bug is a blocker for that backport.
01-02-2022