What is Java Decompiler?
There are times when you need to see the API internal implementation or to know its behavior during development, but if it's not an open source, you may feel frustrated because only the already compiled .class file exists. The Decompiler allows you to decompile back to JAVA grammar based on the compilation rules based on the byte code of the compiled .class file.However, since the decompiler decompiles according to the compile rules, it cannot be returned exactly as the original source. However, it can be very helpful to analyze compiled sources because we show the source according to the JAVA grammar we use when developing, not byte code.
So, You can use Java Decompiler by using the jd-gui program or by installing the Decompiler plug-in from Eclipse.
Installing the JD-GUI
Install jd-gui from the link below.
http://java-decompiler.github.io/
When you run the jd-gui program, you can see the above screen. Click the folder icon in the upper left corner to view the contents of the class file.
Select the class file you want to check and click Open.
Once the file is selected and opened, the class file can be viewed as java-written content.
Installing Java Decompiler from Eclipse
Click the Eclipse top menu. Help > Eclipse Marketplace..
If you search by decompile in the Find input window in Marketplace, you will get two results as below. Here I will try to install the Enhanced Class Decompiler. Click Install.
Click Confirm.
Check I accept... to accept and click Finish.
A security-related alert appears, which appears every time the plug-in is installed, so click Install anyway.
Click Restart Now. The Eclipse is restarted to apply the plug-in.
You can see that the decompiled String.class file opens.
Click Confirm.
Check I accept... to accept and click Finish.
A security-related alert appears, which appears every time the plug-in is installed, so click Install anyway.
Click Restart Now. The Eclipse is restarted to apply the plug-in.
To verify compiled sources
When the compiler plug-in is finished installing, press Ctrl + Shift + T in Eclipse to open the Open Type search pop-up and search for the java.lang.String class, which is your most popular class.You can see that the decompiled String.class file opens.