我有一台装有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


有人知道如何解决这个问题吗?

最佳答案

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

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

09-25 22:01