如何在Eclipse中打开一个jar文件 [英] how to open a jar file in Eclipse
问题描述
我下载了一个demo jar文件,并希望在eclipse中打开它。我所做的是
I downloaded a demo jar file, and would like to open it in eclipse. What I did is
import->现有项目进入工作区 - >选择归档文件
import->Existing projects into workspace ->select archive file
但是,eclipse返回没有项目被导入。
However, the eclipse returns "No projects are found to import".
作为命令行,我键入
java -jar projectDemo.jar
java -jar projectDemo.jar
此jar文件只是功能很好。所以在我看来,jar文件本身就可以,但是如何在Eclipse中打开它并修改这个演示代码?谢谢。
This jar file just functions well. So it seems to me that jar file itself is OK, but how can I open it in Eclipse and modify this demo code? Thanks.
推荐答案
由于jar文件执行,因此它包含被称为.class文件的已编译的java文件。您不能将其导入到eclipse并修改代码。您应该向供应商询问演示的源代码。 (或检查您的源代码的演示页面)
Since the jar file 'executes' then it contains compiled java files known as .class files. You cannot import it to eclipse and modify the code. You should ask the supplier of the "demo" for the "source code". (or check the page you got the demo from for the source code)
除非您要反编译.class文件并导入到Eclipse。初学者可能不是这样。
Unless, you want to decompile the .class files and import to Eclipse. That may not be the case for starters.
这篇关于如何在Eclipse中打开一个jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!