2012年8月3日 星期五

myeclipse反编译插件的安装使用--jd-gui插件


在實際的工作中,可能會用到反編譯工具,尤其對於定制的myeclipse開發平臺,很多的公共方法都進行二次分裝,無法直接查看,通過本外掛程式的安裝,可以直接點擊查看分裝在jar包中的class檔,這對學習SSH的源碼包提供了一定的方便。
注意:本人安裝了該外掛程式,導致myeclipseSVN版本工具無法使用,特此聲明,需要提前進行備份myeclipse
首先下載反編譯工具的安裝包:
將下載的壓縮包拷貝到myeclipse的安裝目錄下(推薦,因為該目錄平臺不做修改,放置到其他地方需要小心被刪除)
在這裡需要用到這麼一個JAVA:
1 import java.io.File;
2 import java.util.ArrayList;
3 import java.util.List;
4
5 public class CreatePluginsConfig {
6 private String path;
7
8 public CreatePluginsConfig(String path) {
9 this.path = path;
10 }
11
12 public void print() {
13 List list = getFileList(path);
14 if (list == null) {
15 return;
16 }
17 int length = list.size();
18 for (int i = 0; i < length; i++) {
19 String result = "";
20 String thePath = getFormatPath(getString(list.get(i)));
21 File file = new File(thePath);
22 if (file.isDirectory()) {
23 String fileName = file.getName();
24 if (fileName.indexOf("_") < 0) {
25 continue;
26 }
27 String[] filenames = fileName.split("_");
28 String filename1 = filenames[0];
29 String filename2 = filenames[1];
30 result = filename1 + "," + filename2 + ",file:/" + path + "\\"
31 + fileName + "\\,4,false";
32 System.out.println(result);
33 } else if (file.isFile()) {
34 String fileName = file.getName();
35 if (fileName.indexOf("_") < 0) {
36 continue;
37 }
38 int last = fileName.lastIndexOf("_");// 最後一個底線的位置
39 String filename1 = fileName.substring(0, last);
40 String filename2 = fileName.substring(last + 1, fileName
41 .length() - 4);
42 result = filename1 + "," + filename2 + ",file:/" + path + "\\"
43 + fileName + ",4,false";
44 System.out.println(result);
45 }
46 }
47 }
48
49 public List getFileList(String path) {
50 path = getFormatPath(path);
51 path = path + "/";
52 File filePath = new File(path);
53 if (!filePath.isDirectory()) {
54 return null;
55 }
56 String[] filelist = filePath.list();
57 List filelistFilter = new ArrayList();
58 for (int i = 0; i < filelist.length; i++) {
59 String tempfilename = getFormatPath(path + filelist[i]);
60 filelistFilter.add(tempfilename);
61 }
62 return filelistFilter;
63 }
64
65 public String getString(Object object) {
66 if (object == null) {
67 return "";
68 }
69 return String.valueOf(object);
70 }
71
72 public String getFormatPath(String path) {
73 path = path.replaceAll("\\\\", "/");
74 path = path.replaceAll("//", "/");
75 return path;
76 }
77
78 public static void main(String[] args) {
79 new CreatePluginsConfig(
80 "D:\\Program Files\\Genuitec\\MyEclipse 8.5 M1\\jdeclipse_update_site\\plugins")
81 .print();// 注意此路徑就是你安裝外掛程式的路徑,根據自己的具體路徑設置
82 }
83 }
只需在最後的幾行中,把自己的減壓的外掛程式的路徑拷貝進入,點擊run,運行:
前面的四行針對的不是windows操作系統的,不必理會,主要是後面三行。
將最後三行拷貝:
找到myeclipse中的該路徑
MyEclipse 8.5 M1\configuration\org.eclipse.equinox.simpleconfigurator
,打開bundles.info檔,將之前的三行數據拷貝到最後(建議用editplus打開)
打開之前,需要備份bundles.info檔,防止出現意外,當出現錯誤資訊後,直接覆蓋原始檔案即可
接下來,在myeclipse中進行配置:
保存,重啟myeclipse即可(假如之前打開):




反編譯成功,通過該工具,大家可以快速的SSH的源碼。

沒有留言: