简体   繁体   English

运行 javafx 应用程序、Netbeans 11、java 12、javafx 13 的问题

[英]Problems running a javafx application, Netbeans 11, java 12, javafx 13

Trying to run a simple hello world example but getting the following error, which I do not understand:尝试运行一个简单的 hello world 示例,但出现以下错误,我不明白:

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

How to solve it?如何解决? Do I need some libs, plugins, configs which are not yet included?我是否需要一些尚未包含的库、插件、配置?

Here is my pom: Tried using Java 9,10,11,12 and JavaFX 12 & 13 and get the same error.这是我的 pom:尝试使用 Java 9,10,11,12 和 JavaFX 12 & 13 并得到相同的错误。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mycompany</groupId>
<artifactId>mavenproject3</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>11</maven.compiler.release>
    <javafx.version>13</javafx.version>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <release>${maven.compiler.release}</release>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.4</version>
            <configuration>
                <mainClass>com.mycompany.mavenproject3.MainApp</mainClass>
                <executable>C:\Program Files\Java\jdk-12\bin\java</executable>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->


    <!-- https://mvnrepository.com/artifact/eu.hansolo/Medusa -->
    <dependency>
        <groupId>eu.hansolo</groupId>
        <artifactId>Medusa</artifactId>
        <version>11.2</version>
    </dependency>

    <dependency>
        <groupId>eu.hansolo</groupId>
        <artifactId>colors</artifactId>
        <version>1.4</version>
    </dependency>

</dependencies>

That is a bug in the dependency eu.hansolo:Medusa:11.2 , as it depends on mac version of JavaFX and hence the modulepath will contain both win and mac versions of JavaFX :这是依赖项eu.hansolo:Medusa:11.2中的一个错误,因为它依赖于 JavaFX 的mac版本,因此模块路径将包含JavaFX winmac版本:

<dependency>
  <groupId>org.openjfx</groupId>
  <artifactId>javafx-controls</artifactId>
  <version>12.0.1</version>
  <classifier>mac</classifier> <---------------
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>org.openjfx</groupId>
  <artifactId>javafx-base</artifactId>
  <version>12.0.1</version>
  <classifier>mac</classifier>  <---------------
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>org.openjfx</groupId>
  <artifactId>javafx-graphics</artifactId>
  <version>12.0.1</version>
  <classifier>mac</classifier>  <---------------
  <scope>runtime</scope>
</dependency>

That was fixed in version 11.3 :这已在11.3版中修复:


The solution:解决方案:

Just update eu.hansolo:Medusa:11.2 to eu.hansolo:Medusa:11.3 and it should work.只需将eu.hansolo:Medusa:11.2更新为eu.hansolo:Medusa:11.3就可以了。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM