用jd-eclipse 插件來反編譯java class文件的輸出還是挺nice的,雖然閱讀方便了 但是對debug確造成一定的困擾,主要問題是line number的不match.
Google了下遇到類似問題的真不少。最終找到了解決方案:
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.
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 補(bǔ)丁讓優(yōu)雅的debug class 文件成為可能。
如果只是為了閱讀class代碼,建議不要用realignment 補(bǔ)丁,這樣會降低代碼的可讀性(會多出大量的空行)