How do I decompile Java class files? and How to use java decompiler in Eclipse?

In this tutorial, I will show you how to install in Eclipse one of the most popular java decompilers – JD.

  • Download and unzip the JD-Eclipse Update Site,
  • Launch Eclipse,
  • Click on “Help > Install New Software…”,
  • Click on the button “Add…” to add a new repository,
  • Enter “JD-Eclipse Update Site” and select the local site directory(where you have unzipped)
  • Check “Java Decompiler Eclipse Plug-in”,
  • Next, next, next… and restart Eclipse.

That’s it, now you have installed JD decompiler in your Eclipse. But what if JD decompiler doesn’t work? In order to fix this you just need to perform the following steps:

  1. Go to Preferences
  2. General > Editors > File Associations
  3. Select “*.class without source”,
  4. add Class File Editor and
  5. make it default. Don’t forget to click on the default

To check that everything is OK now, place the cursor on the class which doesn’t have the source code and press the “F3” button(you can use double click also).

That’s all.