英文:
Java: Could not initialize class
问题
我有一个名为 Appstome.jar
的 JAR 文件。
在两台机器上,我成功运行了该文件:
java -jar Appstome.jar
然而,在第三台机器上,使用相同的 Java JRE,我遇到了以下错误:
无法初始化类 org.appstome.platform.SodiumKt
$ java.io.EOFException
<正确的输出>
我可以看到该 JAR 文件包含了被引用的类:
$ unzip -t /usr/local/bin/Appstome.jar | grep Sodium
testing: org/appstome/platform/SodiumKt.class OK
testing: com/goterl/lazycode/lazysodium/SodiumJava.class OK
testing: com/goterl/lazycode/lazysodium/LazySodium.class OK
testing: com/goterl/lazycode/lazysodium/LazySodium$1.class OK
testing: com/goterl/lazycode/lazysodium/exceptions/SodiumException.class OK
testing: com/goterl/lazycode/lazysodium/Sodium.class OK
testing: com/goterl/lazycode/lazysodium/LazySodiumJava.class OK
正常工作的机器是运行 Ubuntu 的本地笔记本电脑。
第三台机器是运行较旧的 Linux 的远程服务器:
Linux version 3.10.0-862.9.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Mon Jul 16 16:29:36 UTC 2018
有任何可能导致问题的想法吗?
英文:
I have a JAR file named Appstome.jar
.
In two machines, I run the file successfully:
java -jar Appstome.jar
However, in a third machine with the same Java JRE, I get the following error:
Could not initialize class org.appstome.platform.SodiumKt
$ java.io.EOFException
<correct output>
I can see that the JAR file contains the referred class:
$ unzip -t /usr/local/bin/Appstome.jar | grep Sodium
testing: org/appstome/platform/SodiumKt.class OK
testing: com/goterl/lazycode/lazysodium/SodiumJava.class OK
testing: com/goterl/lazycode/lazysodium/LazySodium.class OK
testing: com/goterl/lazycode/lazysodium/LazySodium$1.class OK
testing: com/goterl/lazycode/lazysodium/exceptions/SodiumException.class OK
testing: com/goterl/lazycode/lazysodium/Sodium.class OK
testing: com/goterl/lazycode/lazysodium/LazySodiumJava.class OK
The working machines are local laptops running Ubuntu.
The third machine is in a remote server running an older Linux:
Linux version 3.10.0-862.9.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Mon Jul 16 16:29:36 UTC 2018
Any ideas what might be the problem?
专注分享java语言的经验与见解,让所有开发者获益!
评论