java反编译插件:Eclipse Class Decompiler,能够很方便的使用本插件查看类库源码,以及采用本插件进行Debug调试。
eclipse中安装Eclipse Class Decompiler,截图如下:
(1) 选择Help中的Eclipse Marketplace

(2) 打开后,在搜索框输入jd进行查找,然后选择install安装Eclipse Class Decompiler



(3) Finish后安装完会提示重启eclipse。
(4) 重启后,选择Window-Preferences,搜索 File Associations,把.class和.class without source下面的类反编译查看器置为default。


在myeclipse中安装Eclipse Class Decompiler和eclipse中不同的就一点:Help中的选项不同,myeclipse中选择Help中的Install from Catalog,下面就是一样的了。

下面解释一下反编译器的首选项:

1.重用缓存代码:只会反编译一次,以后每次打开该类文件,都显示的是缓存的反编译代码。
2.忽略已存在的源代码:若未选中,则查看Class文件是否已绑定了Java源代码,如果已绑定,则显示Java源代码,如果未绑定,则反编译Class文件。若选中此项,则忽略已绑定的Java源代码,显示反编译结果。
3.显示反编译器报告:显示反编译器反编译后生成的数据报告及异常信息。
4.使用Eclipse代码格式化工具:使用Eclipse格式化工具对反编译结果重新格式化排版,反编译整个Jar包时,此操作会消耗一些时间。
5.使用Eclipse成员排序:使用Eclipse成员排序对反编译结果重新格式化排版,反编译整个Jar包时,此操作会消耗大量时间。
6.以注释方式输出原始行号信息:如果Class文件包含原始行号信息,则会将行号信息以注释的方式打印到反编译结果中。
7.根据行号对齐源代码以便于调试:若选中该项,插件会采用AST工具分析反编译结果,并根据行号信息调整代码顺序,以便于Debug过程中的单步跟踪调试。
8.设置Class反编译查看器作为缺省的Class文件编辑器:默认为选中,将忽略Eclipse自带的Class Viewer,每次Eclipse启动后,默认使用本插件提供的类查看器打开Class文件。