如何让 Java Decompiler / JD / JD-Eclipse 在 Eclipse Helios 中运行

发布于 2024-10-08 17:20:18 字数 388 浏览 10 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

冷情 2024-10-15 17:20:19
  1. 下载 JD-Eclipse 更新站点(github.com/java-decompiler/jd-eclipse)
  2. 启动 Eclipse,

  3. 单击“帮助 > 安装”新软件...”,

  4. 单击“添加...”按钮添加新存储库,

  5. 输入“JD-Eclipse Update Site”并选择本地站点目录,

  6. < p>选中“Java Decompiler Eclipse 插件”,

  7. 下一步,下一步,下一步...然后重新启动 Eclipse。

  1. Download the JD-Eclipse Update Site(github.com/java-decompiler/jd-eclipse)
  2. Launch Eclipse,

  3. Click on "Help > Install New Software...",

  4. Click on button "Add..." to add an new repository,

  5. Enter "JD-Eclipse Update Site" and select the local site directory,

  6. Check "Java Decompiler Eclipse Plug-in",

  7. Next, next, next... and restart Eclipse.

揽清风入怀 2024-10-15 17:20:19

只需从京东页面下载该站点即可。我能够从 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.

甩你一脸翔 2024-10-15 17:20:19

在 Eclipse 中添加 Java 反编译器的步骤:

  1. 打开 Eclipse IDE。
  2. 单击帮助 ->Eclipse Marketplace Wizard
  3. 在“搜索”选项卡中找到 JD(JD 是获取 Eclipse Class Decompiler 的关键字)
  4. 选择 Eclipse Class Decompiler
  5. 单击“安装”。
  6. 重启Eclipse并检查

Steps to add the Java Decompiler in Eclipse :

  1. Open Eclipse IDE.
  2. Click Help->Eclipse Marketplace Wizard
  3. In Search tab find the JD (JD is keyword to get the Eclipse Class Decompiler)
  4. Select the Eclipse Class Decompiler
  5. Click on Install.
  6. Restart Eclipse and check
情绪 2024-10-15 17:20:19

我使用 Intellij 或 Android studio 来进行反编译,效果非常好。
Intellij 内部遵循 FernFlower 反编译器。
输入图片此处描述

I used Intellij or Android studio both are working awesome for decompiling purpose.
Internally Intellij following FernFlower Decompiler.
enter image description here

梦冥 2024-10-15 17:20:18

这是我遇到的问题:

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.

我最亲爱的 2024-10-15 17:20:18

为了使其在 Eclipse Juno 中工作 - 我必须执行一些额外的步骤。

一般情况下->编辑->文件关联

  1. 选择“*.class”并将“Class File Editor”标记为默认
  2. 选择“*.class without source”->添加-> “类文件编辑器”->设为默认
  3. 重启eclipse

To Make it work in Eclipse Juno - I had to do some additional steps.

In General -> Editors -> File Association

  1. Select "*.class" and mark "Class File Editor" as default
  2. Select "*.class without source" -> Add -> "Class File Editor" -> Make it as default
  3. Restart eclipse
一江春梦 2024-10-15 17:20:18

JD-eclipse插件0.1.3只能反编译从类路径/构建路径中可见的.class文件

如果您的类驻留在 .jar 中,您只需将此 jar 作为另一个库添加到构建路径中即可。从包资源管理器中浏览新库并在类文件编辑器中打开该类。

如果要反编译文件系统上的任何类,它必须驻留在适当的文件夹层次结构中,并且根文件夹必须包含在构建路径中。下面是一个示例:

  1. Class is foo.bar.MyClass in .../someDir/foo/bar/MyClass.class
  2. 在您的 Eclipse 项目中,添加一个具有任意名称 aClassDir 的文件夹,该文件夹链接到 . ../一些目录。
  3. 将链接的文件夹添加到项目的构建路径中。
  4. 使用导航器视图在类文件编辑器中导航并打开 .class 文件。 (注意:文件系统上的普通 .class 文件隐藏在 Package Explorer 视图中。)

注意:如果 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:

  1. Class is foo.bar.MyClass in .../someDir/foo/bar/MyClass.class
  2. In your Eclipse project, add a folder with arbitrary name aClassDir, which links to .../someDir.
  3. Add that linked folder to the Build Path of the project.
  4. Use the Navigator View to navigate and open the .class file in the Class File Editor. (Note: Plain .class files on the file system are hidden in the Package Explorer view.)

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...

几度春秋 2024-10-15 17:20:18

我正在使用 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)

年华零落成诗 2024-10-15 17:20:18

我做了简单的事情来让它工作:

进入 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.

懷念過去 2024-10-15 17:20:18

在 Juno、Kepler 和 Luna 上进行测试后,我发现 JD 仅适用于构建路径上的 *.class 文件

  1. 将 jar 添加为现有项目的 lib
  2. 转到 Preferences->General->Editors->File Associations,将 *.class without source 设置为 Class File Editor 带有杯子图标

After testing on Juno, Kepler and Luna, I found JD only works for *.class files on build path.

  1. Adding the jar as a lib of an existing project
  2. Go to Preferences->General->Editors->File Associations, set *.class without source to Class File Editor with a cup icon
浅语花开 2024-10-15 17:20:18

我使用 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/

黑凤梨 2024-10-15 17:20:18

适用于 Eclipse 版本 3.x 和 4.x 的 JAD Decomplier 插件

更新站点:http ://feeling.sourceforge.net/update

步骤:

  1. 打开 Eclipse IDE。
  2. 单击“帮助”->“安装新软件”
  3. 粘贴上面的 URL 并将名称命名为 JAD。
  4. 选择 Eclipse Class Decompiler
  5. 单击“下一步”并接受协议
  6. 进行安装。
  7. 重新启动 Eclipse 并立即检查。

JAD Decomplier plug-in for Eclipse version 3.x and 4.x.

update site: http://feeling.sourceforge.net/update

Steps:

  1. Open Eclipse IDE.
  2. Click Help->Install New software
  3. Paste above URL and give name as JAD.
  4. Select the Eclipse Class Decompiler
  5. Click on Next and accept agreements
  6. Install it.
  7. Restart Eclipse and check now.
柠北森屋 2024-10-15 17:20:18

如果您需要反编译独立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,

倾城花音 2024-10-15 17:20:18

我执行了步骤 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文