Fedora

.jar 文件無法在 fedora gnome3 上啟動

  • March 22, 2021

表單終端,當我嘗試執行 .jar 文件時,我收到:

$ java -jar ./RemoteDroidServer/RemoteDroidServer.jar 
Exception in thread "main" java.awt.HeadlessException
   at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
   at java.awt.Window.<init>(Window.java:536)
   at java.awt.Frame.<init>(Frame.java:420)
   at java.awt.Frame.<init>(Frame.java:385)
   at AppFrame.<init>(AppFrame.java:42)
   at RemoteDroidServer.main(RemoteDroidServer.java:16)
$

在具有 LX 桌面環境的 Devian 下,相同的文件執行沒有問題:

$ java -jar ./RemoteDroidServer/RemoteDroidServer.jar 
Linux

系統資訊

$ uname -a   
Linux fedora 5.5.10-200.fc31.x86_64 #1 SMP Wed Mar 18 14:21:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

安裝的相關軟體包

# rpm -qa | grep -a "jdk"
java-1.8.0-openjdk-headless-1.8.0.242.b08-0.fc31.x86_64
copy-jdk-configs-3.7-4.fc31.noarch
java-latest-openjdk-13.0.2.8-1.rolling.fc31.x86_64
java-11-openjdk-headless-11.0.6.10-0.fc31.x86_64
java-11-openjdk-11.0.6.10-0.fc31.x86_64
java-latest-openjdk-headless-13.0.2.8-1.rolling.fc31.x86_64

# rpm -qa | grep -a "java"
java-1.8.0-openjdk-headless-1.8.0.242.b08-0.fc31.x86_64
javapackages-filesystem-5.3.0-6.fc31.noarch
abrt-java-connector-1.1.4-1.fc31.x86_64
java-latest-openjdk-13.0.2.8-1.rolling.fc31.x86_64
tzdata-java-2019c-2.fc31.noarch
java-11-openjdk-headless-11.0.6.10-0.fc31.x86_64
java-11-openjdk-11.0.6.10-0.fc31.x86_64
java-latest-openjdk-headless-13.0.2.8-1.rolling.fc31.x86_64

GitHub 和 GoogleCode 上的 RemoteDroidServer:

https://github.com/alrusdi/remotedroid/tree/master/RemoteDroidServer/src
https://github.com/attilla/remotedroid/tree/master/RemoteDroidServer
https://code.google.com/archive/p/remotedroid/

根據評論更新

# java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
# cd RemoteDroidServer/ && java -jar RemoteDroidServer.jar
Exception in thread "main" java.awt.HeadlessException
   at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
   at java.awt.Window.<init>(Window.java:536)
   at java.awt.Frame.<init>(Frame.java:420)
   at java.awt.Frame.<init>(Frame.java:385)
   at AppFrame.<init>(AppFrame.java:42)
   at RemoteDroidServer.main(RemoteDroidServer.java:16)

最新更新

出於其他原因,我決定嘗試 KDE-Plasma,令我驚訝的是,.jar 程序可以與這個 DE 一起使用!

我在 Mobian-LXDE 系統 ( https://wiki.mobian-project.org/doku.php?id=desktopenvironments#lxde ) 上的 AWT 庫遇到了同樣的問題。解決方案就像安裝default-jre軟體包一樣簡單。

學分轉到:

https ://stackoverflow.com/questions/5241850/running-java-gui-applications-through-a-linux-terminal/5242043#5242043

我還沒有機會在 fedora-GNOME 上進行測試。


更新

這個問題似乎dnf update在我的 fedora-GNOME 上徹底消失了,或者它已通過具有兩個桌面環境安裝/更新的 KDE-Plasma-5 相關軟體包解決。

引用自:https://unix.stackexchange.com/questions/574843