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.
![](https://t1.daumcdn.net/cfile/tistory/998C97375B6BD2D824)
Click Confirm.
![](https://t1.daumcdn.net/cfile/tistory/99409B375B6BD2D907)
Check I accept... to accept and click Finish.
![](https://t1.daumcdn.net/cfile/tistory/992E533E5B6BD2DA15)
A security-related alert appears, which appears every time the plug-in is installed, so click Install anyway.
![](https://t1.daumcdn.net/cfile/tistory/99CEDF475B6BD2DA1A)
Click Restart Now. The Eclipse is restarted to apply the plug-in.
![](https://t1.daumcdn.net/cfile/tistory/99C4D43C5B6BD2DB05)
![](https://t1.daumcdn.net/cfile/tistory/99E04C345B6BD2DC1B)
You can see that the decompiled String.class file opens.
![](https://t1.daumcdn.net/cfile/tistory/99C8933E5B6BD2DC21)
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.