leftso 1974 0 2021-08-20
版权申明:本文为博主原创文章,未经博主允许不得转载。 https://www.leftso.com/blog/835.html

问题描述

JavaFX maven项目在idea中启动报错:
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)

解决办法

在VM参数中添加以下配置:
-Djava.library.path=C:/
idea 启动类VM参数配置
idea 启动类VM参数配置
提示:本文最后更新于【 2021-08-20 21:33:25 】,某些文章具有时效性,若有错误或已失效,请在下方留言

评论区域