JavaFX 11 using Maven throws Exception: “WindowsNativeRunloopThread”

醉酒当歌 提交于 2019-12-05 13:36:09

This is not Eclipse only problem. I have exactly the same issue when running OpenJFX app in Intellij IDEA 2018.3.2. If any other Java version specified in Windows %Path% env variable then forementioned exception will be thrown.

For instance I use Java 8 as default SDK and playing with Java 11. It's not working that way. It work only if I'll delete Java 8 bin directory from %Path%.

This is rather confusing (and I believe it's a bug) because I don't see any relations to Java 8 when I launch my project in IDE:

C:\Software\Java\openjdk-11\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Project\helloworld -Dmaven.home=C:\Software\Maven\3.6.0 -Dclassworlds.conf=C:\Software\Maven\3.6.0\bin\m2.conf "-javaagent:C:\Software\IntelliJ IDEA\CE_2018.3.2\lib\idea_rt.jar=64808:C:\Software\IntelliJ IDEA\CE_2018.3.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Software\Maven\3.6.0\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3.2 -T 2 -DskipTests=true exec:java
macster110

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

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

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

As suggested in the post linked to by @kleopatra, the problem is that javafx11 is loading the wrong glass.dll file.

While the workaround suggested in other answers works, the OpenJFX tutorial suggests, when possible, to instruct eclipse to use the Java 11 VM to run, so that the correct dll is loaded.

You can modify your eclipse.ini file and (supposing your jdk11 is installed in C:\Program Files\Java\jdk-11.0.2) add the following lines:

-vm
C:\Progra~1\Java\jdk-11.0.2\bin\javaw.exe
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!