简体   繁体   English

在Eclipse中将Java Source导出到JAR文件

[英]Exporting Java Source to JAR file in Eclipse

When Exporting the Source code folder to JAR file in Eclipse it is getting exported with some warnings 在Eclipse中将源代码文件夹导出到JAR文件时,它会导出并带有一些警告

When the exported JAR file is decompiled and checked , there are some class files which when opened showing error message like 当对导出的JAR文件进行反编译和检查时,有一些类文件在打开时显示错误消息,例如

  "Invalid class file <fileName.class>: Can not read buffer"

What are the possible reasons for this problem and how to avoid that 此问题的可能原因是什么,以及如何避免该问题

I am using Eclipse Luna Service Release 2 (4.4.2 ) 我正在使用Eclipse Luna Service Release 2(4.4.2)

When you are going to export jar file from eclipse follow following step: 当您要从eclipse导出jar文件时,请执行以下步骤:

  1. File-> Export 文件->导出

  2. Select following checkboxes and destination folder. 选择以下复选框和目标文件夹。

在此处输入图片说明

  1. Now again deselect following checkboxes. 现在再次取消选择以下复选框。

在此处输入图片说明

  1. Select like this image. 选择喜欢这张图片。

在此处输入图片说明

  1. Then finish. 然后完成。

  2. Goto to folder where you saved jar file and run java -jar jarname.jar 转到保存jar文件并运行java -jar jarname.jar的文件夹

  3. Then you can decompile jar file using JD GUI and check your classes are decompiled correctly or not. 然后,您可以使用JD GUI反编译jar文件,并检查您的类是否正确反编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM