反编译java class并优雅的调试--http://www.blogjava.net/miaoyachun/archive/2013/02/22/395575.html

https://sourceforge.net/projects/realignmentjd/files/ 官方文档



用jd-eclipse 插件来反编译java class文件的输出还是挺nice的,虽然阅读方便了 但是对debug确造成一定的困扰,主要问题是line number的不match.
Google了下遇到类似问题的真不少。最终找到了解决方案:
http://sourceforge.net/projects/realignmentjd/files/
-----------------

1. Download JD-Eclipse and JD-GUI - http://java.decompiler.free.fr/ and install.
2. Put a file realignment.jd.ide.eclipse_1.0.2.jar in eclipse/plugins directory.
    To use Realignment feature it is necessary to open the menu Preferences/General/Editors/File Associations and to select "*.class" file type and to choose "Realignment for JD Class File Editor" for Associated editors.
    Another possibility is the batch realignment after processing JD-GUI. To work properly you must to switch on the property "Display line numbers" in Help/Preferences of JD-GUI.
    To use this feature it is necessary to open the menu Preferences/Java/Decompiler/Batch Realignment and click button "Open dialog". Existing limitation: the realignment is performed only for the methods.
    To work properly it is necessary that the property "Display line numbers" in menu "Preferences/Java/Decompiler" was active.


JD-Eclipse插件 + realignment 补丁让优雅的debug class 文件成为可能。

如果只是为了阅读class代码,建议不要用 realignment 补丁,这样会降低代码的可读性(会多出大量的空行)


猜你喜欢

转载自blog.csdn.net/a363722188/article/details/78048379
今日推荐