javaFlang中的java.lang.UnsatisfiedLinkError:com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z

时间:2018-12-12 14:12:22

标签: ubuntu javafx

我有一台装有Ubuntu 16.10(yakkety)的计算机,它可以完美地运行javafx应用程序。但是,即使我具有相同的openjfx软件包(8u102-b14-1),当我尝试在另一台使用ubuntu 18.10(宇宙)的计算机上运行相同的应用程序时,却遇到此异常。其他openjfx仿生软件包也不起作用。

$ java -jar target/app.jar

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:267)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
    at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    ... 5 more
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
    at com.sun.glass.ui.gtk.GtkApplication._isDisplayValid(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.isDisplayValid(GtkApplication.java:83)
    at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:67)
    at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
    at com.sun.glass.ui.Application.run(Application.java:146)
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
    ... 9 more

有人知道如何解决吗?

2 个答案:

答案 0 :(得分:1)

在ubuntu 18中,我将openfx,libopenjfx-java,libopenjfx-jni降级:

sudo apt-get install libopenjfx-java = 8u161-b12-1ubuntu2 libopenjfx-jni = 8u161-b12-1ubuntu2 sudo apt install openjfx = 8u161-b12-1ubuntu2

答案 1 :(得分:0)

确保您使用的libopenjfx-javalibopenjfx-jni版本相同,并且没有混合使用Java 8和Java 11。