[英]Running .jar file from cmd returna "Error initializing QuantumRenderer: no suitable pipeline found" error
I have a JavaFX project which runs perfectly well in IntelliJ, but when I tried to create a .jar and run it, I got this error:我有一个在 IntelliJ 中运行良好的 JavaFX 项目,但是当我尝试创建一个 .jar 并运行它时,我收到了这个错误:
Error: JavaFX runtime components are missing, and are required to run this application
So I ran所以我跑了
Java -jar --module-path C:\"Program Files (x86)"\Java\javafx-sdk-18.0.1\lib --add-modules=javafx.controls,javafx.fxml,javafx.swing .\myJar.jar
which resulted in this:结果是:
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@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:266)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at javafx.graphics@18.0.1/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:833)
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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: No toolkit found
at javafx.graphics@18.0.1/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:278)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:291)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:163)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:659)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:410)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
... 5 more
I managed to make it work by copying all JavaFX .dlls from home/JavaFX-SDK/bin
to where my executable .jar is.我设法通过将所有 JavaFX .dll 从
home/JavaFX-SDK/bin
复制到我的可执行文件 .jar 所在的位置来使其工作。 None of the other suggestions were working.其他建议都没有奏效。
I was working with Netbeans tho我正在与 Netbeans 合作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.