vServer Linux - 启动 jar:jarfile 无效或损坏

2022-01-24 00:00:00 server debian java eclipse jar

我正在使用 Debian 8.0 64 位运行 Linux vServer512 MB RAM 和 150GB 空间.

I'm running a Linux vServer with Debian 8.0 64 bit with 512 MB RAM and 150GB space.

它计划将它用于游戏并让 Server.jar 不间断地运行.服务器正在使用 Kryonet,这是一个用于简单客户端/服务器通信的库.在我的服务器上,我安装了 Java 1.8,它运行良好,为了测试我下载了 Minecraft 服务器 jar,它运行良好.所以我用eclipse(编译版本1.8)将我的服务器打包到一个可执行jar中,在我的计算机上使用cmd启动它时它工作正常(安装了Java 8)但是当试图在服务器上启动它时:错误:无效或损坏的jarfile Server.jar

Its planned to use it for a game and let a Server.jar run nonstop. The Server is working with Kryonet, a library for simple Client/Server communication. On my server i installed Java 1.8 and its working fine, for testing i downloaded Minecraft server jar, it works perfectly. So i packed my Server into a executable jar with eclipse (compile version 1.8), it worked fine when starting it with cmd on my computer (Java 8 installed) but when trying to start it on the server: Error: Invalid or corrupt jarfile Server.jar

我认为这可能是我使用的库有问题,所以我尝试了一个干净的 HelloWorld jar,但也不起作用.

I thought it could be a problem with the librarys i used, so i tried a clean HelloWorld jar, also does not work.

这是显示我安装的 java 版本并尝试运行我的 HelloWorld jar 的屏幕截图.

Here is a screenshot showing my installed java version and trying to run my HelloWorld jar.

推荐答案

我解决了这个问题!

jar 确实已损坏:我使用 mediafire 作为主机并使用直接下载链接通过 wget <url> 将 jar 下载到服务器上,从而将 jar 传输到服务器上.

The jar really was corrupted: I transfered the jar on my server by using mediafire as hoster and using the direct download link to download the jar on to the server via wget <url>.

似乎 mediafire 正在损坏 jars(可能是通过压缩它们),所以我使用 Dropbox 作为主机,一切正常!

Seemingly mediafire was damaging the jars (maybe by compressing them), so i used Dropbox as hoster and everything worked fine!

我希望我能帮助遇到同样问题的人.

I hope i can help someone having the same problem.

相关文章