如何让 Java Decompiler / JD / JD-Eclipse 在 Eclipse Helios 中运行
Java Decompiler (JD) 通常被推荐为一个很好的 Java 反编译器。 JD-Eclipse是京东的Eclipse插件。
我在几台不同的机器上运行插件时遇到了问题。每当我尝试打开 .class 文件时,标准的“未找到源”编辑器都会显示,显示低级字节码反汇编,而不是您期望从反编译器获得的 Java 源输出。
安装文档位于 http://java.decompiler.free.fr/?q=jdeclipse 在故障排除方面还不错,但相当模糊。
打开这个问题收集更多信息:JD在Eclipse Helios中运行之前遇到了什么问题?解决办法是什么?
Java Decompiler (JD) is generally recommended as a good, well, Java Decompiler. JD-Eclipse is the Eclipse plugin for JD.
I had problems on several different machines to get the plugin running. Whenever I tried to open a .class file, the standard "Source not found" editor would show, displaying lowlevel bytecode disassembly, not the Java source output you'd expect from a decompiler.
Installation docs in http://java.decompiler.free.fr/?q=jdeclipse are not bad but quite vague when it comes to troubleshooting.
Opening this question to collect additional information: What problems did you encounter before JD was running in Eclipse Helios? What was the solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
启动 Eclipse,
单击“帮助 > 安装”新软件...”,
单击“添加...”按钮添加新存储库,
输入“JD-Eclipse Update Site”并选择本地站点目录,
下一步,下一步,下一步...然后重新启动 Eclipse。
Launch Eclipse,
Click on "Help > Install New Software...",
Click on button "Add..." to add an new repository,
Enter "JD-Eclipse Update Site" and select the local site directory,
Check "Java Decompiler Eclipse Plug-in",
Next, next, next... and restart Eclipse.
只需从京东页面下载该站点即可。我能够从 Eclipse 安装软件部分的本地站点进行安装。
Just download the site from the JD page. I was able to install from a local site in the isntalled software section of eclipse.
在 Eclipse 中添加 Java 反编译器的步骤:
Steps to add the Java Decompiler in Eclipse :
我使用 Intellij 或 Android studio 来进行反编译,效果非常好。
Intellij 内部遵循 FernFlower 反编译器。
I used Intellij or Android studio both are working awesome for decompiling purpose.
Internally Intellij following FernFlower Decompiler.
这是我遇到的问题:
1) RTFM 并安装提到的“Microsoft Visual C++ 2008 SP1 Redistributable Package”
在安装文档的顶部。我一开始错过了这一点,因为赫利俄斯的说明在最后。
2) 在打开类文件之前关闭所有打开的编辑器选项卡。否则,很容易从之前的尝试中获得过时的编辑器选项卡。
3)在“Java类文件编辑器”(不是“Java类文件查看器”)中打开类文件。使用上下文菜单中的“打开方式”来获取正确的编辑器。如果对结果感到满意,请将其设为文件关联设置中的默认编辑器,在窗口/首选项常规/编辑器/文件关联中选择 *.class 以使用“Java 类文件编辑器”打开。
4) 此人建议从 Helios 更新站点安装 Equinox SDK。我做到了,但我不确定这是否真的有必要。有人知道吗?
5) 如果您尝试查看的类文件位于 Eclipse Java 项目中,则它们需要位于项目的构建路径中。否则,Eclipse 错误日志中将显示异常(“不在构建路径中”),并且反编译将失败。我将类文件作为库/类文件夹添加到构建路径中。
6) 从 Windows 资源管理器中拖放类文件或使用“文件/打开文件...”将其打开将不起作用。在我的测试中,我给出了“无法打开编辑器:类文件查看器无法处理给定的输入('org.eclipse.ui.ide.FileStoreEditorInput')”。错误。无论如何,这可能是错误的编辑器,请参阅 3)。
7) 插件基本运行后,有些文件仍然无法反编译,原因不明。关闭所有选项卡、重新启动 Helios 并重试后,此问题消失。
Here's the stuff I ran into:
1) RTFM and install the "Microsoft Visual C++ 2008 SP1 Redistributable Package" mentioned
at top of the installation docs. I missed this at first because the Helios instructions are at the end.
2) Close all open editor tabs before opening a class file. Otherwise it's easy to get an outdated editor tab from a previous attempt.
3) Open the class file in the "Java Class File Editor" (not "Java Class File Viewer"). Use "Open With" in the context menu to get the right editor. If pleased with results, make it the default editor in the File Association settings, in Window/Preference General/Editors/File Associations select *.class to open with "Java Class File Editor".
4) This guy recommends installing the Equinox SDK from the Helios update site. I did, but I'm not sure if this was really necessary. Anyone know?
5) If the class files you are trying to view are in an Eclipse Java project, they need to be in the project's build path. Otherwise, an exception ("Not in the build path") will show up in the Eclipse error log, and decompile will fail. I added the class files as a library / class file folder to the build path.
6) Drag/dropping a class file from Windows Explorer or opening it with File/Open File... will not work. In my tests, I gives a "Could not open the editor: The Class File Viewer cannot handle the given input ('org.eclipse.ui.ide.FileStoreEditorInput')." error. That is probably the wrong editor anyways, see 3).
7) After getting the plugin basically running, some files would still not decompile for an unknown reason. This disappeared after closing all tabs, restarting Helios, and trying again.
为了使其在 Eclipse Juno 中工作 - 我必须执行一些额外的步骤。
一般情况下->编辑->文件关联
To Make it work in Eclipse Juno - I had to do some additional steps.
In General -> Editors -> File Association
JD-eclipse插件0.1.3只能反编译从类路径/构建路径中可见的.class文件。
如果您的类驻留在 .jar 中,您只需将此 jar 作为另一个库添加到构建路径中即可。从包资源管理器中浏览新库并在类文件编辑器中打开该类。
如果要反编译文件系统上的任何类,它必须驻留在适当的文件夹层次结构中,并且根文件夹必须包含在构建路径中。下面是一个示例:
注意:如果 someDir 是项目的子文件夹,您可能可以跳过步骤 2(链接文件夹)并将其直接添加到 Build 中小路。但如果它是 Eclipse 项目的编译器输出文件夹,则不起作用。
PS 我希望我可以双击任何项目子文件夹中的任何 .class 文件,而不需要将其放在类路径中...
The JD-eclipse plugin 0.1.3 can only decompile .class files that are visible from the classpath/Build Path.
If your class resides in a .jar, you may simply add this jar to the Build Path as another library. From the Package Explorer browse your new library and open the class in the Class File Editor.
If you want to decompile any class on the file system, it has to reside in the appropriate folder hierachy, and the root folder has to be included in the build path. Here is an example:
Note: If someDir is a subfolder of your project, you might be able to skip step 2 (link folder) and add it directly to the Build Path. But that does not work, if it is the compiler output folder of the Eclipse project.
P.S. I wish I could just double click any .class file in any project subfolder without the need to have it in the classpath...
我正在使用 Eclipse 3.7 Indigo 和 Windows 7 64 位:
我所做的是按照网站的建议和 @Universalspezialist 的提醒安装 Microsoft Visual C++ 2008 SP1 Redistributable Package。
然后按照站点中所述安装插件: http://java.decompiler.free.fr/ ?q=jdeclipse
转到首选项,然后找到“文件关联”
单击*.class,然后将“class File Editor”设置为默认值。
也许重新启动 Eclipse? (我这样做了,但我不确定是否有必要)
I am using Eclipse 3.7 Indigo and Windows 7 64-bit:
What I did was to install the Microsoft Visual C++ 2008 SP1 Redistributable Package as suggested by the site and reminded by @Universalspezialist.
Then install the plugin as stated in the site: http://java.decompiler.free.fr/?q=jdeclipse
Go to preference, then find "File Associations"
Click on the *.class, then set the "class File Editor" as default.
Restart Eclipse perhaps? (I did this, but I'm not sure if it's necessary or not)
我做了简单的事情来让它工作:
进入 eclipse > >窗口>首选项
(可选)在搜索框中键入“文件”以帮助修剪选项树。
去了一般>编辑>文件关联。
单击“.class”类型。下面有2个编辑器,我点击了“类文件编辑器”——带有JD图标的那个,点击了右侧的“默认”按钮。
完毕。
现在你所有的班级都属于我们了。
Simple thing i did to get it working:
Went in eclipse > Window > Preferences
(Optional)typed in the search box "file" to help trim the tree of options.
Went to General > Editors > File associations.
Clicked the ".class" type. Below there were 2 editors present, i clicked on the "Class File Editor" - the one with the icon from JD, clicked the "Default" button on the right.
Done.
Now all ur class are belong to us.
在 Juno、Kepler 和 Luna 上进行测试后,我发现 JD 仅适用于构建路径上的 *.class 文件。
*.class without source
设置为Class File Editor
带有杯子图标After testing on Juno, Kepler and Luna, I found JD only works for *.class files on build path.
*.class without source
toClass File Editor
with a cup icon我使用 jadeclipse 代替,因为它无法在 3.6/3.7 eclipse 中工作
更新站点
http://webobjects.mdimension.com/jadclipse/3.6/
安装
http://5thcross.wordpress.com/2009/05/ 20/在 eclipse 中安装 jadclipse/
I use jadeclipse instead, because it can't work in 3.6/3.7 eclipse
Update site
http://webobjects.mdimension.com/jadclipse/3.6/
Intallation
http://5thcross.wordpress.com/2009/05/20/installing-jadclipse-in-eclipse/
适用于 Eclipse 版本 3.x 和 4.x 的 JAD Decomplier 插件
更新站点:http ://feeling.sourceforge.net/update
步骤:
JAD Decomplier plug-in for Eclipse version 3.x and 4.x.
update site: http://feeling.sourceforge.net/update
Steps:
如果您需要反编译独立jar,请尝试由同一作者(JD-Eclipse)编写的JD-GUI。它是一个独立的应用程序(不需要 eclipse)。它可以打开 *.class 和 *.jar 文件。有趣的是,它需要安装 .Net(JD-Eclipse 确实如此),但除此之外,它的工作方式就像一个魅力。
在这里找到它:
http://jd.benow.ca/
问候,
if you need to decompile standalone jar try JD-GUI by the same autor (of JD-Eclipse). It is a standalone application (does not need eclipse). It can open both *.class and *.jar files. Interesting enough it needs .Net installed (as do JD-Eclipse indeed), but otherwise works like a charm.
Find it here:
http://jd.benow.ca/
Regards,
我执行了步骤 1、2、3 和 7。并将包含类文件的文件夹放入项目构建路径中(右键单击、属性、java 构建路径、库、添加类文件夹、创建新文件夹、高级>> ;,链接到文件系统中的文件夹,浏览,...)然后重新启动 Eclipse。
I made the steps 1, 2, 3 and the 7. and I put the folder with the class files in the project build path (right click, properties, java build path, libraries, add class folder, create new folder, advanced>>, link to folder in the file system, browse,...) then restart eclipse.