[英]jar created on windows doesn't work on linux
I exported a runnable jar from Eclipse on windows 8.1. 我在Windows 8.1上从Eclipse导出了一个可运行的jar。 When I try t tun it on kali linux it gives 'Invalid or corrupt jarfile' 当我尝试在kali linux上对其进行调整时,它给出了“无效或损坏的jarfile”
I then created the jar using intellij, but it give the same error on kali linux. 然后,我使用intellij创建了jar,但在kali linux上却给出了相同的错误。
Jar works fine on my windows system created by either method. Jar可以在我用任何一种方法创建的Windows系统上正常工作。 I am using oracle jdk 6 to export the jar. 我正在使用oracle jdk 6导出jar。 On kali linux I have openjdk installed. 在kali linux上,我安装了openjdk。
Oupout of unzip DocUploder.jar
on kali linux 在Kali Linux上unzip DocUploder.jar
Archive: DocUploder.jar
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
note: DocUploder.jar may be a plain executable, not an archive
unzip: cannot find zipfile directory in one of DocUploder.jar or
DocUploder.jar.zip, and cannot find DocUploder.jar.ZIP, period.
Well, since the answer is obvious after the long chat I'd provide the action list that helps to find problem like "my jar does not run". 好吧,由于经过长时间的聊天之后答案很明显,因此我将提供操作列表以帮助查找“我的jar无法运行”之类的问题。
ClassNotFoundException
or ClassDefNotFoundError
check classpath. 如果抛出ClassNotFoundException
或ClassDefNotFoundError
检查类路径。 If it throws NoSuchMethodException
or similar check compatibility of your libraries. 如果抛出NoSuchMethodException
或类似内容,请检查您的库的兼容性。 jar vft your.jar
(if you have JDK) or commands like unzip
on linux or extract zip file on windows. 要检查jar文件,请尝试jar vft your.jar
(如果您有JDK)或诸如在Linux上unzip
或在Windows上unzip
zip之类的命令。 If this does not work - jar file is corrupted. 如果这不起作用-jar文件已损坏。 ls -l
on unix or dir
on windows. 在Unix上使用ls -l
或在Windows上使用dir
。 If files have the same size try to compare them by creating hash. 如果文件大小相同,请尝试通过创建散列来比较它们。 Use md5sum my.jar
on linux and tool like WinMd5
on windows. 使用md5sum my.jar
在Linux和工具,如WinMd5
在Windows上。 Other possibility is to copy file forward and back and check that it is still ok. 另一种可能性是向前和向后复制文件,并检查它仍然可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.