插件所需包
1.解压jad1.5.8g.zip.将jad.exe放到jre的bin目录下,下载地址: http://ishare.iask.sina.com.cn/f/15708995.html?from=dl
如笔者在D:\program files\Java\jre6\bin下
2.安装jadeclipse 下载地址 http://jaist.dl.sourceforge.net/sourceforge/jadclipse/net.sf.jadclipse_3.3.0.jar
将jadclipse_3.1.0.jar复制插件目录
个人机器上环境为myeclipse版本为7.5,eclipse版本为3.3.其它版本方式一致.
eclipse安装目录的\plugins目录下,如笔者:D:\program files\eclipse\plugins
myeclipse拷贝到Common\plugins目录下,如笔者:D:\program files\Genuitec\Common\plugins
对于eclipse安装
如下: Windows —> Perference —> Java下面应该会多出一个JadClipse目录,,相关的设置可以在此修改配置jadclipse:
设置path to decompiler为jad.exe的全路径,如笔者的:D:\program files\Java\jre6\bin\jad.exe
如果存在中文反编译的问题则点击Window > Preferences > Java > JadClipse > Misc,将Convert Unicode strings into ANSI strings选项打勾。
至此插件安装成功,点击class文件即可查看源码,如图查看mongodb的源码
对于myeclipse安装
MyEclipse自从7.0后就不再提供link安装,而是采用在bundles.info文件写入配置信息的方式安装插件。具体步骤如下:
1.下载你需要的安装的插件,其结构需要与link安装时候一致:
+yourPluginName (你的插件文件名--父)
+----plugins (默认需要的文件夹--子)
+----features (默认需要的文件夹--子)
eg.我的文件结构为
+jadplugin
+ ------features
+-------plugins
2.将插件文件夹复制到自定义插件文件夹(就是你自己便于管理,自建的文件夹,D:\program files\Genuitec\Common\jadplugin\plugins下)
3.利用myeclipse新建一个java文件,代码如下:
import java.io.File;
import java.util.ArrayList;
import java.util.List;//MyEclipse 7.5 插件配置代码生成器
public class PluginUtil {public PluginUtil() {}public void print(String path) {List list &#61; getFileList(path);if (list &#61;&#61; null) {return;}int length &#61; list.size();for (int i &#61; 0; i ) {String result &#61; "";String thePath &#61; getFormatPath(getString(list.get(i)));File file &#61; new File(thePath);if (file.isDirectory()) {String fileName &#61; file.getName();if (fileName.indexOf("_") <0) {print(thePath);continue;}String[] filenames &#61; fileName.split("_");String filename1 &#61; filenames[0];String filename2 &#61; filenames[1];result &#61; filename1 &#43; "," &#43; filename2 &#43; ",file:/" &#43; path &#43; "//"&#43; fileName &#43; "//,4,false";System.out.println(result);} else if (file.isFile()) {String fileName &#61; file.getName();if (fileName.indexOf("_") <0) {continue;}int last &#61; fileName.lastIndexOf("_");// 最后一个下划线的位置String filename1 &#61; fileName.substring(0, last);String filename2 &#61; fileName.substring(last &#43; 1, fileName.length() - 4);result &#61; filename1 &#43; "," &#43; filename2 &#43; ",file:/" &#43; path &#43; "//"&#43; fileName &#43; ",4,false";System.out.println(result);}}}public List getFileList(String path) {path &#61; getFormatPath(path);path &#61; path &#43; "/";File filePath &#61; new File(path);if (!filePath.isDirectory()) {return null;}String[] filelist &#61; filePath.list();List filelistFilter &#61; new ArrayList();for (int i &#61; 0; i ) {String tempfilename &#61; getFormatPath(path &#43; filelist[i]);filelistFilter.add(tempfilename);}return filelistFilter;}public String getString(Object object) {if (object &#61;&#61; null) {return "";}return String.valueOf(object);}public String getFormatPath(String path) {path &#61; path.replaceAll("", "/");path &#61; path.replaceAll("//", "/");return path;}public static void main(String[] args) {/* 你的插件的安装目录.参数String plugin 内容即为你所要安装插件的绝对路径。安装时只需要换成自己的插件路径即可 */String plugin &#61; "D:/Program Files//Genuitec/Common/jadplugin";new PluginUtil().print(plugin);}
}
4.运行上述代码,
5.将控制台输出的内容全部复制到D:/Program Files/Genuitec/MyEclipse 7.5/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info文件中。
5.重启myeclipse完成安装。
后面的配置和eclipse安装中的一致.