如何解决D3D的图形设备初始化失败问题(&SW&Quot;)

How to solve the amp;quot;Graphics Device initialization failed for : d3d, swamp;quot; Problem(如何解决D3D的图形设备初始化失败问题(amp;SWamp;Quot;))

本文介绍了如何解决D3D的图形设备初始化失败问题(&SW&Quot;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动使用JavaFX 11+的应用程序时遇到以下RuntimeException

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:243)
    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:567)
    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:835)
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:567)
    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

推荐答案

下载JavaFX11+后解压文件,解压后切换到IntelliJ IDEA。然后按照IntelliJ IDEA中的以下步骤操作。

  1. 文件
  2. 项目结构
  3. 全局库
  4. 按"+"号,然后按Java
  5. 转到您刚刚下载的JavaFX 11+文件夹。进入文件夹,现在进入"lib",选择文件夹中除"src.zip"之外的所有文件,然后按右下角的"OK",将其保存为"javafx12"。
  6. 现在您将鼠标指针移动到"+"下方,然后右键单击您命名为"javafx12"的库,此时将打开一个带有不同选项的小窗口,但是在您完成操作之后,您可以在"Add to Modules"上按鼠标指针,将鼠标指针移动到"src"文件夹,然后用鼠标右键单击。现在打开一个具有各种选项的宽窗口,但是您选择了"New"选项,现在已经打开了一个具有许多不同选项的宽窗口,但是您再次选择了"module-info.java",现在您复制以下文本:

    module YOUR-PROJECT-NAME {
    
        requires javafx.graphics;
        requires javafx.controls;
        requires javafx.media;
        requires javafx.base;
        requires javafx.web;
        requires javafx.swing;
        requires javafx.fxml;
    
        opens application;
    }
    

这解决了问题。

这篇关于如何解决D3D的图形设备初始化失败问题(&SW&Quot;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何解决D3D的图形设备初始化失败问题(&SW&Quot;)

基础教程推荐