启动时出现 launch4j 错误,无法安装 Ubuntu 18.04

启动时出现 launch4j 错误,无法安装 Ubuntu 18.04

我是新手,不熟悉手动安装 Ubuntu 软件。我想安装launch4j。我已遵循指南StackExchange以及其他在线网站。

无论我尝试什么,无论是否使用 sudo,使用 chmod 获得执行权限,我都会遇到这个问题:

 ❮ onyr ★  kenzae❯ ❮ Downloads❯❯ sudo tar xf launch4j-3.12-linux.tgz -C /opt
 ❮ onyr ★  kenzae❯ ❮ ~❯❯ cd /opt/launch4j/
 ❮ onyr ★  kenzae❯ ❮ launch4j❯❯ ll
total 288
-rwxr-xr-x  1 root root    160 mai   17  2018 launch4j*
-rwx---r-x  1 root root 199603 mai   17  2018 launch4j.jar*
[...]
 ❮ onyr ★  kenzae❯ ❮ launch4j❯❯ sudo ./launch4j 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/opt/launch4j/lib/xstream.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at net.sf.launch4j.Main.main(Main.java:59)
Caused by: java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 10 more

我正在使用Java13:

 ❮ onyr ★  kenzae❯ ❮ launch4j❯❯ java --version
java 13.0.2 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

我没什么主意了。我该怎么办?谢谢,保重,

奥尼尔

编辑

按照建议,我尝试使用以下命令使用 JDK 8

sudo apt-get install openjdk-8-jre
sudo update-java-alternatives --set java-1.8.0-openjdk-amd64

但是,我仍然收到同样的错误......

 ❮ onyr ★  kenzae❯ ❮ ~❯❯ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
 ❮ onyr ★  kenzae❯ ❮ usr❯❯ cd /opt/launch4j/
 ❮ onyr ★  kenzae❯ ❮ launch4j❯❯ ./launch4j 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/opt/launch4j/lib/xstream.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at net.sf.launch4j.Main.main(Main.java:59)
Caused by: java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 10 more

有关我安装的 Java 的更多信息,也许问题出在那里:

 ❮ onyr ★  kenzae❯ ❮ jvm❯❯ sudo update-java-alternatives --set java-1.8.0-openjdk-amd64
update-alternatives: error: no alternatives for jabswitch
update-alternatives: error: no alternatives for jaccessinspector
update-alternatives: error: no alternatives for jaccesswalker
update-alternatives: error: no alternatives for kinit
update-alternatives: error: no alternatives for klist
update-alternatives: error: no alternatives for ktab
update-alternatives: error: no alternatives for mozilla-javaplugin.so
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
 ❮ onyr ★  kenzae❯ ❮ jvm❯❯ pwd
/usr/lib/jvm
 ❮ onyr ★  kenzae❯ ❮ jvm❯❯ ll
total 40
drwxr-xr-x   5 root root  4096 févr. 29 18:36 ./
drwxr-xr-x 146 root root 12288 mars  28 13:39 ../
lrwxrwxrwx   1 root root    25 avril  8  2018 default-java -> java-1.11.0-openjdk-amd64/
lrwxrwxrwx   1 root root    21 oct.   7  2018 java-1.11.0-openjdk-amd64 -> java-11-openjdk-amd64/
-rw-r--r--   1 root root  2044 janv. 15 16:14 .java-1.11.0-openjdk-amd64.jinfo
drwxr-xr-x   9 root root  4096 févr.  1 14:11 java-11-openjdk-amd64/
drwxr-xr-x   9 root root  4096 févr. 21 16:53 java-13-oracle/
-rw-r--r--   1 root root  3667 févr. 21 16:53 .java-13-oracle.jinfo
lrwxrwxrwx   1 root root    20 janv. 18 00:41 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64/
-rw-r--r--   1 root root  2712 janv. 18 00:41 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x   7 root root  4096 févr. 29 18:36 java-8-openjdk-amd64/

答案1

您必须使用以下命令安装 OpenJDK 8 而不是 Oracle Java 13:

sudo apt-get install openjdk-8-jre
sudo update-java-alternatives --set java-1.8.0-openjdk-amd64

然后./launch4j就会显示窗口。

相关内容