【轉】Eclipse中查看jar包中的源碼


(簡單的方式:通過jd-gui來進行反編譯,最簡單!,參考我的另一篇博文,

地址:http://www.cnblogs.com/gmq-sh/p/4277991.html)

 

Java Decompiler Plugin For Eclipse IDE

1. 下載JAD ,
 1.5.8版本的jad在 http://www.softpedia.com/progDownload/JAD-Download-85911.html 

將展開后的jad.exe放到某個目錄,例如 c:/jad/jad.exe

2. 下載JADClipse插件

http://sourceforge.net/projects/jadclipse/files/ 
將展開后的net.sf.jadclipse_3.3.0.jar放入Eclipse的plugins子目錄下

3. 啟動Eclipse
    注意:eclipse需要重新啟動

4. 配置Jadclipse, 在 Windows - Preferences - Java - JadClipse下
配置Jad的路徑為 C:/jad/jad.exe;

只需編輯這一個值就ok了

 

如下圖所示

 

5:eclipse重新啟動,即可。

 

6:

In Eclipse, try F3 into any class which does not has the source, Jad will decompile it automatically.

see examples :

Java代碼   收藏代碼
  1. *jadclipse*/// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.  
  2. // Jad home page: http://www.kpdus.com/jad.html  
  3. // Decompiler options: packimports(3) radix(10) lradix(10)   
  4. // Source File Name:   JSObject.java  
  5.    
  6. package netscape.javascript;  
  7.    
  8. import java.applet.Applet;  
  9. import sun.plugin.javascript.JSContext;  
  10.    
  11. // Referenced classes of package netscape.javascript:  
  12. //            JSException  
  13.    
  14. public abstract class JSObject  
  15. {  

 

 

 

運行過程中可能出現的錯誤:

1:

 

Java代碼   收藏代碼
  1. /*jadclipse*/  
  2.   
  3. /*  
  4. DECOMPILATION REPORT  
  5.   
  6. Decompiled from: C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\rt.jar  
  7. Total time: 16 ms  
  8. Jad reported messages/errors:  
  9. Exit status: 0  
  10. Caught exceptions:  
  11. java.io.IOException: Cannot run program "jad" (in directory "C:\Documents and Settings\Administrator\.net.sf.jadclipse\1262594305781"): CreateProcess error=2, ϵͳÕҲ»µ½ָ¶  
  12. at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)  
  13. at java.lang.Runtime.exec(Runtime.java:593)  
  14. at net.sf.jadclipse.JadDecompiler.decompile(JadDecompiler.java:160)  
  15.   
  16.   
  17. Decompiled from: /opt/ATG/ATG10.0.2/DAS/lib/servlet.jar  
  18. Total time: 26 ms  
  19. Jad reported messages/errors:  
  20. Exit status: 0  
  21. Caught exceptions:  
  22. java.io.IOException: Cannot run program “jad” (in directory “/home/citrisys/.net.sf.jadclipse/1311068558030″): java.io.IOException: error=2, No such file or directory  
  23. at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)  

  錯誤原因:

   Make sure your “jad.exe ” in existed in that folder.

     配置Jadclipse, 在 Windows - Preferences - Java - JadClipse下
    配置Jad的正確路徑。


其他:

Juno Eclipse版本需要

 配置文件關聯關系,在Preference中file associations中配置*.class & *.class without source 的default editors為jad,到此就可以使用jad的反編譯功能了。

 配置所需的jar包和程序http://download.csdn.net/detail/zljjava/4284865

 

查看更簡單的查看源代碼:jd-gui.exe:http://www.cnblogs.com/gmq-sh/p/4277991.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM