简体   繁体   English

如果我在eclipse中更改bin文件夹,为什么jar会损坏?

[英]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.

相关问题 为什么eclipse不能将所有jar文件移动到服务器lib文件夹? - why eclipse does not move all jar files to server lib folder? 为什么Eclipse将不必要的文件复制到bin文件夹中? - Why Eclipse copies unnecessary files into the bin folder? Eclipse bin文件夹位置 - Eclipse bin folder location 经过xslt转换后,为什么在Tomcat / bin文件夹中生成文件? 如何将此目录更改为webapps / myApp? - After xslt transformation why file is generated in Tomcat/bin folder ? How can i change this directory to webapps/myApp? 为什么Eclipse看不到库的.jar文件? - Why Eclipse does not see .jar file of a library? 为什么Eclipse无法从lib文件夹检测到jar文件 - why eclipse not detect the jar file from lib folder 为什么当我更改最大堆大小时eclipse不会打开? - Why eclipse does not open when I change the max heap size? 如何在程序包位于根文件夹中的位置创建JAR? (而不是在bin文件夹中) - How do I create a JAR where the package is in the root folder? (and not inside a bin folder) Java + Eclipse SWT项目,试图将文件夹路径放入“ jar” - Java + Eclipse SWT project, trying to get folder path into the “jar” 尽管我将jar文件添加到classpath(Eclipse),为什么Connection to SQLite会失败? - Why does Connection to SQLite fail although I added jar file to classpath (Eclipse)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM