无法在 Windows 上使用 JavaFX 11 运行 Maven 着色 jar

起初我得到了缺少 JavaFX 运行时组件的错误,这导致我进入了这个线程。在该线程中应用解决方案后,即创建一个不扩展 Application 的不同 Main 类,我收到一条新的错误消息,下面是 -Dprism.verbose=true 的完整堆栈跟踪:


Prism pipeline init order: d3d sw

Using Double Precision Marlin Rasterizer

Using dirty region optimizations

Not using texture mask for primitives

Not forcing power of 2 sizes for textures

Using hardware CLAMP_TO_ZERO mode

Opting in for HiDPI pixel scaling

Prism pipeline name = com.sun.prism.d3d.D3DPipeline

GraphicsPipeline.createPipeline failed for com.sun.prism.d3d.D3DPipeline

java.lang.ClassNotFoundException: com.sun.prism.d3d.D3DPipeline

        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)

        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

        at java.base/java.lang.Class.forName0(Native Method)

        at java.base/java.lang.Class.forName(Class.java:315)

        at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)

        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)

        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)

        at java.base/java.lang.Thread.run(Thread.java:834)

*** Fallback to Prism SW pipeline

Prism pipeline name = com.sun.prism.sw.SWPipeline

GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline

java.lang.ClassNotFoundException: com.sun.prism.sw.SWPipeline

我尝试了不同的 JDK 11 版本,但它们都提供了相同的错误消息


料青山看我应如是
浏览 336回答 1
1回答

largeQ

我设法解决了我的问题。原因是我有<minimizeJar>true</minimizeJar>在 Maven Shade 插件中,它会自动从 jar 中删除 javafx-graphics。我通过添加一个显式过滤器来包含所有 openjfx 依赖项来解决它,即添加<filter>&nbsp; &nbsp; <artifact>org.openjfx</artifact>&nbsp; &nbsp; <includes>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<include>**</include>&nbsp; &nbsp; </includes></filter>到插件的配置
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java