Java: 无法初始化类

huangapple 未分类评论62阅读模式
英文:

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
&lt;correct output&gt;

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?

huangapple
  • 本文由 发表于 2020年5月3日 23:53:27
  • 转载请务必保留本文链接:https://java.coder-hub.com/61577400.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定