If you are working with eclipse IDE, it provides many plugins and one of them is java decompiler. This plugin will decompile all your class files to give you Java source code.
JD-Eclipse is a plug-in for the Eclipse platform. It allows you to display all the Java sources during your debugging process, even if you do not have them all.
Steps to install java Decompiler in eclipse:
1. Open Eclipse and click Help on the main menu.
2. Click on Install New Software. This will bring a new Install window.
3. Click on ADD to add a new repository with URL: http://jd.benow.ca/jd-eclipse/update
4. Make sure you check both Java De-compiler Eclipse Plug-in and JD-Eclipse Plug-in:
5. Click Next and Finish.
6. There is one more important step pending:
In your eclipse application go to Windows > Preferences
General > Editors > File Associations
Click Add for Associated Editors
Select *.class and add Class File Editor and make it default.
Select *.class without source and add Class File Editor and make it default.
Now you can open your code and you should be able to decompile any of your jar files by either Ctrl + Clicking on the code base or via your Package Explorer.
7. How to import your jar file in eclipse:
7.1 Right-click on your package Explorer -> import -> Java EE -> App client Jar file, you will see following dialog box:
7.2 Click on Next button. Next Dialog screen will ask you to enter jar file location and project name:
7.3 Click on finish button. After little processing, you can open you class files in eclipse. When you open your project in project explorer you will see following project structure:
in above screenshot purge is the name of the project and imported Classes folder will contain all class files of your project. Class may be a library file or your own source code.
7.4 Double click on your class file and it will show you the source code:
But the above class file is non editable. If you want to edit the class file, do following :
Right click on class file name in package explorer then open with Class File Editor option.
Now you can also edit your class file.