[英]Why does a jar get corrupted if i change the bin folder in eclipse?
I have a finished program which compiled successfully and works just fine. 我有一个完成的程序,可以成功编译并且可以正常运行。 Out of interest, I wanted to see the bytecode in the project folder in eclipse (under the bin folder).
出于兴趣,我想在Eclipse的项目文件夹中(bin文件夹下)查看字节码。 I accidentally saved it as a .txt rather than a .class and now the jar file won't work!
我不小心将其保存为.txt而不是.class,现在jar文件将无法工作! It's not an issue, i've fixed it but why does this happen?
这不是问题,我已经解决了,但是为什么会发生呢?
I presume it's simply because you changed the file extension, Eclipse couldn't find the .class file, and so it considered the .jar corrupt. 我认为这仅仅是因为您更改了文件扩展名,Eclipse找不到.class文件,因此它认为.jar损坏。
The output of a Java compiler is not executable code, but is actually bytecode. Java编译器的输出不是可执行代码,但实际上是字节码。 If Eclipse can't find this bytecode, it cannot execute your code.
如果Eclipse找不到此字节码,则它将无法执行您的代码。
I've found another answer that shows a plugin that will allow you to view bytecode using Eclipse in the future. 我找到了另一个答案 ,该答案显示了一个插件,该插件将来允许您使用Eclipse查看字节码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.