4

我正在为我的项目使用 IntelliJ、Gradle、AdoptOpenJDK 12 和 OpenJFX。我正在尝试创建一个简单的 HelloWorld 程序来开始使用 OpenJFX。我的项目在 OracleJDK 上运行良好,但是当我切换到 AdoptOpenJDK 12 并运行项目时,我在控制台中收到以下错误:

Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found

Caused by: java.lang.RuntimeException: No toolkit found

我曾尝试切换到 IBM JDK,但也没有运气。

4:21:13 PM: Executing task 'run'...

Gradle Daemon started in 2 s 311 ms
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE

> Task :run FAILED
Loading library prism_d3d from resource failed: java.lang.UnsatisfiedLinkError: C:\Users\Kula\.openjfx\cache\11.0.2\prism_d3d.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
java.lang.UnsatisfiedLinkError: C:\Users\Kula\.openjfx\cache\11.0.2\prism_d3d.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
                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:2617)
                at java.base/java.lang.Runtime.load0(Runtime.java:767)
                at java.base/java.lang.System.load(System.java:1831)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:205)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:185)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:157)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
                at javafx.graphics/com.sun.prism.d3d.D3DPipeline.lambda$static$0(D3DPipeline.java:48)
                at java.base/java.security.AccessController.doPrivileged(Native Method)
                at javafx.graphics/com.sun.prism.d3d.D3DPipeline.<clinit>(D3DPipeline.java:44)
                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:187)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
                at java.base/java.lang.Thread.run(Thread.java:834)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: C:\Users\Kula\.openjfx\cache\11.0.2\prism_sw.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
java.lang.UnsatisfiedLinkError: C:\Users\Kula\.openjfx\cache\11.0.2\prism_sw.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
                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:2617)
                at java.base/java.lang.Runtime.load0(Runtime.java:767)
                at java.base/java.lang.System.load(System.java:1831)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:205)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:185)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:157)
                at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:52)
                at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
                at java.base/java.security.AccessController.doPrivileged(Native Method)
                at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
                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:187)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
                at java.base/java.lang.Thread.run(Thread.java:834)
Graphics Device initialization failed for :  d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
                at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
                at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
                at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
                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: Error initializing QuantumRenderer: no suitable pipeline found
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
                at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
                at java.base/java.lang.Thread.run(Thread.java:834)
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: No toolkit found
                at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
                at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
                at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
                at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
                ... 5 more
4

1 回答 1

4

我遇到了类似的问题,根本原因是我安装了

OpenJDK12U-jdk_x86-32_windows_hotspot_12.0.2_10.msi

而不是正确的版本

OpenJDK12U-jdk_x64_windows_hotspot_12.0.2_10.msi

解决方案分辨率

  1. 确保获得正确版本的 from

https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.2%2B10

  1. 如果你正在使用 gradle。然后在你的 gradle.properties 文件中指向正确的 JDK 版本

org.gradle.java.home=C:/Program Files/AdoptOpenJDK/jdk-12.0.2.10-hotspot

于 2019-09-12T15:05:04.707 回答