Eclipse 開啟 class 檔案

有時候拿到一些 jar 或是 class 卻沒有辦法看到內容,用強制打開也只會看到一堆亂碼,這邊記錄一下怎麼透過 Eclipse 開啟 class 檔案。

很簡單就可以做到這件事,不過看起來好像不能修改(不確定),直接開始吧!

首先到 Java Decompiler 官網,找到 JD-Eclipse 且換到 Download 下載 jd-eclipse-site-1.0.0-RC2.zip

下方有安裝流程:

  1. 下載 jd-eclipse-site-1.0.0-RC2.zip,並解壓縮到一個地方放
  2. 開啟 Eclipse
  3. 「Help > Install New Software … 」
  4. 點選 Add… 加入新的 repository
  5. 輸入 “JD-Eclipse Update Site”,名字可以打自己記得住的就好
  6. 選取 “Java Decompiler Eclipse Plug-in”
  7. 一直下一步,到結束後重啟 Eclipse

看起來很像步驟很多,其實一下子就弄好了,接下來要設定跟 Eclipse 的關聯,讓開啟 class 檔的時候,可以自動套用 Java Decompiler。

開啟 Eclipse -> Window -> Preferences

General -> Editors -> File Associations -> 找到 *.class,下方把 “JD Class File Viewer” 設定成 Default,下次只要雙擊 class 檔案,就會自動使用 Java Decompiler 插件開啟了。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *