1.下载反编译工具jad(下面提供下载)

将下载下来的jadstar158.zip解压缩,将jad.exe文件放入jdk安装目录下

如:C:\Program Files\Java\jdk1.6.0_20\bin 

2.下载eclipse反编译插件net.sf.jadclipse_3.3.0.jar(下面提供下载)

3.将net.sf.jadclipse_3.3.0.jar 放入MyEclipse安装目录下,

 如 :安装目录\Genuitec\dropins下 没有dropins,新建之,然后在dropins中新建features文件夹和plugins文件夹,将net.sf.jadclipse_3.3.0.jar拷贝到plugins中,然后新建java工程,运行以下代码(替换其中最后的代码,你电脑反编译插件所在的实际位置):

 

 




[java] ​​view plain​​​​copy​​​​​​​​​

 


  1. import java.io.File;     
  2. import java.util.ArrayList;     
  3. import java.util.List;     
  4.   
  5. /**   
  6. * MyEclipse10.0 插件配置代码生成器   
  7. *   
  8. *   
  9. */    
  10.   
  11. public class CreatePluginsConfig     
  12. {     
  13.     
  14.     public CreatePluginsConfig()     
  15.     {     
  16.     }     
  17.     
  18.     public void print(String path)     
  19.     {     
  20.         List<String> list = getFileList(path);     
  21.         if (list == null)     
  22.         {     
  23.             return;     
  24.         }     
  25.     
  26.         int length = list.size();     
  27.         for (int i = 0; i < length; i++)     
  28.         {     
  29.             String result = "";     
  30.             String thePath = getFormatPath(getString(list.get(i)));     
  31.             File file = new File(thePath);     
  32.             if (file.isDirectory())     
  33.             {     
  34.                 String fileName = file.getName();     
  35.                 if (fileName.indexOf("_") < 0)     
  36.                 {     
  37.                     print(thePath);     
  38.                     continue;     
  39.                 }     
  40.                 String[] filenames = fileName.split("_");     
  41.                 String filename1 = filenames[0];     
  42.                 String filename2 = filenames[1];     
  43.                 result = filename1 + "," + filename2 + ",file:/" + path + "\\"    
  44.                         + fileName + "\\,4,false";     
  45.                 System.out.println(result);     
  46.             } else if (file.isFile())     
  47.             {     
  48.                 String fileName = file.getName();     
  49.                 if (fileName.indexOf("_") < 0)     
  50.                 {     
  51.                     continue;     
  52.                 }     
  53.                 int last = fileName.lastIndexOf("_");// 最后一个下划线的位置     
  54.                 String filename1 = fileName.substring(0, last);     
  55.                 String filename2 = fileName.substring(last + 1, fileName     
  56.                         .length() - 4);     
  57.                 result = filename1 + "," + filename2 + ",file:/" + path + "\\"    
  58.                         + fileName + ",4,false";     
  59.                 System.out.println(result);     
  60.             }     
  61.     
  62.         }     
  63.     }     
  64.     
  65.     public List<String> getFileList(String path)     
  66.     {     
  67.         path = getFormatPath(path);     
  68.         path = path + "/";     
  69.         File filePath = new File(path);     
  70.         if (!filePath.isDirectory())     
  71.         {     
  72.             return null;     
  73.         }     
  74.         String[] filelist = filePath.list();     
  75.         List<String> filelistFilter = new ArrayList<String>();     
  76.     
  77.         for (int i = 0; i < filelist.length; i++)     
  78.         {     
  79.             String tempfilename = getFormatPath(path + filelist[i]);     
  80.             filelistFilter.add(tempfilename);     
  81.         }     
  82.         return filelistFilter;     
  83.     }     
  84.     
  85.     public String getString(Object object)     
  86.     {     
  87.         if (object == null)     
  88.         {     
  89.             return "";     
  90.         }     
  91.         return String.valueOf(object);     
  92.     }     
  93.     
  94.     public String getFormatPath(String path)     
  95.     {     
  96.         path = path.replaceAll("\\\\", "/");     
  97.         path = path.replaceAll("//", "/");     
  98.         return path;     
  99.     }     
  100.     
  101.     public static void main(String[] args)     
  102.     {     
  103.         /*替换成你的插件的安装目录*/   
  104.         String plugin = "D:\\MyEclipse 10\\MyEclipse 10\\dropins\\plugins";  
  105.         new CreatePluginsConfig().print(plugin);     
  106.     }     
  107. }    


 

4.重启MyEclipse,配置 jadclipse

 

在Eclipse 的Windows—> Perferences—>General->Editors->File Associations 中修改“*.class”默认关联的编辑器为“JadClipse Class File Viewer”。如果没有*.class,则点击“add"增加一个。

  

 

 

 

 

 

 

如果遇到如下错误,解决方式:

 

eclipse中添加jad插件

 

 

1. 下载jad: http://www.softpedia.com/progDownload/JAD-Download-85911.html

下载后, 将解压后的jad.exe放到某个目录下, 如: D:java/jad.exe(后面会用到这个路径)

2. 下载jadClipse插件: http://sourceforge.net/projects/jadclipse/files/

将解压后的jar文件放到Eclipse的plugins子目录下

3. 重启eclipse

4. 配置JadClipse:

打开Windows ->Preferences -> Java -> JadClipse选项, 在path to decomplier: 文本框中写入D:\java\jad.exe(先前下载jad.exe的路径)

然后,点击确定, 重启eclipse即可完成jad插件的添加

 

另外, 出现如下问题, 多半是JadClipse没有配置好, 按上述步骤配置即可解决问题.

 

/*jadclipse*/

 

/*

 DECOMPILATION REPORT

 

 Decompiled from: D:\workspace\MyEclipse 8.5\BeanUtilsTest\lib\commons-beanutils-1.8.3.jar

 Total time: 3 ms

 Jad reported messages/errors:

 Exit status: 0

 Caught exceptions:

java.io.IOException: Cannot run program "D:\java" (in directory "C:\Users\administrator\.net.sf.jadclipse\1372683520891"): CreateProcess error=5, ¾ܾø·Ã

 at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)

 at java.lang.Runtime.exe*(Runtime.java:593)

 at net.sf.jadclipse.JadDecompiler.decompile(JadDecompiler.java:160)

 at net.sf.jadclipse.JadDecompiler.decompileFromArchive(JadDecompiler.java:217)

 at net.sf.jadclipse.JadclipseSourceMapper.findSource(JadclipseSourceMapper.java:150)

 at net.sf.jadclipse.JadclipseSourceMapper.findSource(JadclipseSourceMapper.java:83)

 at net.sf.jadclipse.JadclipseClassFileEditor.doOpenBuffer(JadclipseClassFileEditor.java:87)

 at net.sf.jadclipse.JadclipseClassFileEditor.doSetInput(JadclipseClassFileEditor.java:45)

 at net.sf.jadclipse.JadclipseActionBarContributor.setActiveEditor(JadclipseActionBarContributor.java:87)

 at org.eclipse.ui.internal.EditorActionBars.partChanged(EditorActionBars.java:342)

 at org.eclipse.ui.internal.WorkbenchPage$3.run(WorkbenchPage.java:632)

 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

 at org.eclipse.core.runtime.Platform.run(Platform.java:888)

 at org.eclipse.ui.internal.WorkbenchPage.activatePart(WorkbenchPage.java:621)

 at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3527)

 at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:614)

 at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2869)

 at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)

 at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)

 at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)

 at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

 at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)

 at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)

 at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)

 at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:374)

 at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:178)

 at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:229)

 at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:208)

 at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlink.open(JavaElementHyperlink.java:74)

 at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseUp(HyperlinkManager.java:406)

 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:207)

 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)

 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)

 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)

 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)

 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)

 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)

 at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)

 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)

 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)

 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)

 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)

 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

 at java.lang.reflect.Method.invoke(Method.java:597)

 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)

 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)

 at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

Caused by: java.io.IOException: CreateProcess error=5, ¾ܾø·Ã

 at java.lang.ProcessImpl.create(Native Method)

 at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)

 at java.lang.ProcessImpl.start(ProcessImpl.java:30)

 at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)

 ... 54 more

 

*/