使用Maven的JavaFX 11引发异常: [英] JavaFX 11 using Maven throws Exception: "WindowsNativeRunloopThread"

查看:617
本文介绍了使用Maven的JavaFX 11引发异常:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Maven 测试JavaFX 11,但无法使其正常工作.我已经安装了Open JDK 11,如果添加jar来从可下载的.zip构建路径,则一切正常.

I have been testing JavaFX 11 using Maven and cannot get it to work. I have Open JDK 11 installed and if adding jars to build path from downloadable .zip everything works just fine.

但是,当我从 javafx 11 网站使用推荐的POM文件时,会得到以下内容错误.

However when I use the recommended POM file from the javafx 11 site I get the following error.

Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
    at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Screen.java:412)
    at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
    at javafx.graphics/com.sun.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
    at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

此处,这个问题似乎已经出现了,但是没有一个解决方案在那个线程中工作了.

This problem seems to have cropped up once here but none of the solutions in that thread have worked.

有人对如何诊断问题有建议吗?我正在Eclipse 4.9中运行,并附加了两个项目的屏幕快照,除了一个使用maven之外,其他两个项目都是相同的,另一个使用的jar添加到了构建路径.任何帮助,不胜感激. 两个项目.javafx11mvn是一个Maven项目,它从POM文件中加载javafx11的依赖关系,java11test2是一个标准的Java项目,其javadx11罐子被添加到构建路径中.

Does anyone have suggestions on how to go about diagnosing the problem? I am running in Eclipse 4.9 and have attached a screenshot of two projects which are identical other than one uses maven and the other has jars added to the build path. Any help much appreciated.

推荐答案

此问题的解决方案是在注释(kleopatra)中.为了快速参考,您需要添加

The solution to this problem is in comments (kleopatra). For quick reference you need to add

-Djava.library.path=C:/anywhere-outside-eclipse 

(我使用-Djava.library.path=C:/测试了)VM参数.这意味着javafx 11在Eclipse中可与Maven一起使用.

(I tested using -Djava.library.path=C:/) to the VM arguments. This means javafx 11 works with Maven inside eclipse.

这篇关于使用Maven的JavaFX 11引发异常:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆