打開class文件,我目前了解的有2種類型的軟件:
一、在eclipse外部打開jar文件。
Java Decompiler.exe,主頁(yè)JD home page: http://java.decompiler.free.fr ,該軟件可以打開整個(gè)jar包,功能很強(qiáng)大。
二、在eclipse內(nèi)部打開jar文件。
net.sf.jadclipse_3.3.0.jar、jad158g.win.zip,需要這兩個(gè)文件。
準(zhǔn)備工作:
1、下載jad.exe文件:http://www.varaneckas.com/jad
2、下載jadeclipse插件:http://sourceforge.net/projects/jadclipse/files/
安裝如下:
1、將jadeclipse插件net.sf.jadclipse_3.3.0.jar 拷貝到myeclipse安裝目錄E:\MyEclipse 6.0\eclipse\myplugins\jad\eclipse\plugins目錄下,并在目錄E:\MyEclipse 6.0\eclipse\links下新建文件jad.link,內(nèi)容如下path=E:\\MyEclipse 6.0\\eclipse\\myplugins\\jad\\
2、將jad.exe解壓到指定目錄。如:D:\tools
3、在eclipse窗口下,點(diǎn)擊Window > Preferences > Java > JadClipse > Path to Decompiler。(設(shè)置jad的絕對(duì)路徑,如 D:\tools\jad\jad.exe)。Use Eclipse code formatter(overrides Jad formatting instructions)選項(xiàng)打勾,與格式化出來(lái)的代碼樣式一致。
4、在eclipse窗口下,點(diǎn)擊Window > Preferences > Java > JadClipse > Misc,將Convert Unicode strings into ANSI strings選項(xiàng)打勾,避免反編譯后可能出現(xiàn)的中文亂碼。
5、重新啟動(dòng)myeclipse,eclipse自動(dòng)將JadClipse Class File Viewer設(shè)置成class文件的缺省打開方式。如果沒(méi)有默認(rèn),可以在Eclipse的Window > Preferences >General >Editors> File Associations中修改“*.class”默認(rèn)關(guān)聯(lián)的編輯器為“JadClipse Class File Viewer”。設(shè)置完成后,雙擊*.class文件,eclipse將自動(dòng)反編譯。