简体   繁体   English

JavaFX 非模块化项目图形设备初始化失败:d3d,sw 初始化 QuantumRenderer 时出错:找不到合适的管道

[英]JavaFX non-modular project Graphics Device initialization failed for : d3d, sw Error initializing QuantumRenderer: no suitable pipeline found

I'm trying to get JavaFX to work on windows 10 with a non-modular project.我正在尝试让 JavaFX 使用非模块化项目在 windows 10 上工作。 I have Java version 14.0.1 and JavaFX version 15.0.1.我有 Java 版本 14.0.1 和 JavaFX 版本 15.0.1。 I followed the instructions listed here exactly, but when I run the program it gives me this error:我完全按照此处列出的说明进行操作,但是当我运行程序时,它给了我这个错误:

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:244)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:261)
    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:564)
    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:832)
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:564)
    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:273)
    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

I've also looked at these questions( 1 , 2 , 3 ), and I did what they said but I still get an error when I run it.我也看过这些问题( 123 ),我按照他们说的做了,但是运行它时仍然出现错误。 I downloaded the JavaFX sdk file from the official download website , and my VM options are:我从官方下载网站下载了JavaFX sdk文件,我的VM选项是:

--module-path "C:\Program Files\Java\javafx-sdk-15.0.1\lib" --add-modules=javafx.controls,javafx.fxml 

I've tried changing the module path to a path in a different location as well as a path with no spaces to no avail.我尝试将模块路径更改为不同位置的路径以及没有空格的路径,但均无济于事。 I've also tried using Eclipse, Netbeans, and no IDE (all setup instructions were from the official website ), but none of them work.我也尝试过使用 Eclipse、Netbeans 和没有 IDE(所有设置说明都来自官方网站),但它们都不起作用。 The program which I'm trying to run is a just a test program.我试图运行的程序只是一个测试程序。

package sample;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) {
        try {
            // create a new Text shape
            Text messageText = new Text("Hello World! Lets learn JavaFX.");

            // stack page
            StackPane root = new StackPane();

            // add Text shape to Stack Pane
            root.getChildren().add(messageText);

            Scene scene = new Scene(root,400,400);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.show();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

EDIT: Response to the answer编辑:对答案的回应

Sorry for the late reply, but I tried to put what you said in the VM options, which I think is what you mean, but I got an error抱歉回复晚了,但我尝试将您所说的内容放在 VM 选项中,我认为这就是您的意思,但出现错误

Error: Could not find or load main class run.jvmargs=--module-path
Caused by: java.lang.ClassNotFoundException: run.jvmargs=--module-path.

I also tried running it without the run.jvmargs= but it also doesn't work.我也尝试在没有 run.jvmargs= 的情况下运行它,但它也不起作用。 I got the below error.我收到以下错误。

Error: Could not find or load main class \
Caused by: java.lang.ClassNotFoundException: \

By the way the specific VM options that I have are below.顺便说一下,我拥有的特定 VM 选项如下。

run.jvmargs=--module-path "C:\\Program Files\\Java\\javafx-sdk-15.0.1\\lib" \
    --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web \
    --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED \
    --add-exports=javafx.web/com.sun.webkit.network=ALL-UNNAMED \
    --add-exports=javafx.web/com.sun.webkit.dom=ALL-UNNAMED \
    --add-exports=javafx.graphics/com.sun.scenario.animation.shared=ALL-UNNAMED \
    --add-exports=javafx.graphics/com.sun.javafx.tk.quantum=ALL-UNNAMED

EDIT - 2:编辑 - 2: 右侧的文件结构

my project also uses this run.jvmargs property.我的项目也使用这个 run.jvmargs 属性。 HTere's HTere的

run.jvmargs=--module-path "D:\\Libraries\\Java9\\openjfx-13.0.2_windows-x64_bin-sdk\\javafx-sdk-13.0.2\\lib" \
    --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web \
    --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED \
    --add-exports=javafx.web/com.sun.webkit.network=ALL-UNNAMED \
    --add-exports=javafx.web/com.sun.webkit.dom=ALL-UNNAMED \
    --add-exports=javafx.graphics/com.sun.scenario.animation.shared=ALL-UNNAMED \
    --add-exports=javafx.graphics/com.sun.javafx.tk.quantum=ALL-UNNAMED // <<-- notice this thing

also, make sure you're using \\ instead of \另外,请确保您使用的是 \\ 而不是 \

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 JavaFx 运行 Java Jar 文件时如何解决“图形设备初始化失败:d3d,sw” - How to solve "Graphics Device initialization failed for : d3d, sw" when running a java Jar file with JavaFx 如何解决“图形设备初始化失败:d3d,sw”问题 - How to solve the "Graphics Device initialization failed for : d3d, sw" Problem 图形设备初始化失败:d3d,使用 JDK 1.8.0u131 和 NetBeans 8.2 在 windows xp 32 位上的 sw - Graphics Device initialization failed for : d3d, sw on windows xp 32-bit using JDK 1.8.0u131 and NetBeans 8.2 JavaFX图形设备初始化失败:es2,sw - JavaFX Graphics Device initialization failed for : es2, sw Linux 上的 JavaFX 显示“图形设备初始化失败:es2,sw” - JavaFX on Linux is showing a "Graphics Device initialization failed for : es2, sw" JavaFX、OS X、图形设备初始化失败:es2、sw - JavaFX, OS X, Graphics Device initialization failed for : es2, sw 从 cmd 运行 .jar 文件返回“初始化 QuantumRenderer 时出错:找不到合适的管道”错误 - Running .jar file from cmd returna "Error initializing QuantumRenderer: no suitable pipeline found" error 图形设备初始化失败:es2,sw - Graphics Device initialization failed for : es2, sw JavaFX——模块化和非模块化的区别 - JavaFX - difference between modular and non-modular 打包非模块化JavaFX应用程序 - Package a non-modular JavaFX application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM