在 Eclipse 中查看来自第三方 jar 的源代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7633748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Viewing source code from a third-party jar in Eclipse
提问by user496934
I am working on a Java project in Eclipse. In this I am using a third party JAR which I have put in on the classpath. Now I want to understand the code in the JAR file and want to see the actual code and navigate through the third party code just like my own code.
我正在 Eclipse 中开发一个 Java 项目。在此,我使用了我已放在类路径中的第三方 JAR。现在我想了解 JAR 文件中的代码,并想查看实际代码并像我自己的代码一样浏览第三方代码。
My question is this: Instead of me manually decompiling all of the class files in the JAR and putting them in the appropriate folder as per package declaration, is there some way in which Eclipse will decompile them for me, and put them in the appropriate folder? What should be the approach taken in such a scenario?
我的问题是:不是我手动反编译 JAR 中的所有类文件并将它们按照包声明放在适当的文件夹中,而是有什么方法可以让 Eclipse 为我反编译它们,并将它们放在适当的文件夹中? 在这种情况下应该采取什么方法?
采纳答案by Matthew Farwell
The decompiler I use is JAD. It has an eclipse plugin, Jadclipse.
我使用的反编译器是 JAD。它有一个 Eclipse 插件 Jadclipse。
You can download JAD from http://www.varaneckas.com/jad
您可以从http://www.varaneckas.com/jad下载 JAD
You can get Jadclipse from http://sourceforge.net/projects/jadclipse/. Click on the download jar and then simply copy the jar into your Eclipse/plugins directory, and restart Eclipse. Set up the path to JAD from Preferences->Java->JADClipse. Then trying to view a class should give the decompiled code.
您可以从http://sourceforge.net/projects/jadclipse/获取 Jadclipse 。单击下载 jar,然后简单地将 jar 复制到 Eclipse/plugins 目录中,然后重新启动 Eclipse。从 Preferences->Java->JADClipse 设置 JAD 的路径。然后尝试查看一个类应该给出反编译的代码。
回答by epoch
I have been using Java Decompiler for some time and have found it very useful, i don't know about eclipse but it seems to have a eclipse plugin: JD-Eclipse
我已经使用 Java Decompiler 有一段时间了,发现它非常有用,我不知道 eclipse 但它似乎有一个 eclipse 插件:JD-Eclipse
回答by Dan Bizdadea
I would suggest to ask for the source code from the third party and put it in your project. Decompiling it may be agains their will :)
我建议向第三方索取源代码并将其放入您的项目中。反编译它可能违背他们的意愿:)

