The one IntelliJ IDEA uses is fernflower, but it can't handle recent things - like String/Enum switches, generics (didn't test this one personally, only read about it).
You could use one of these (you can both use them online or download them, there is some info about each of them) : For decompiling lots of class files of which you do not have source code, you will need some other java decompiler, which is specialized for this job, and most likely runs standalone. It is only meant to help programmers peek at the bytecode of the java classes that they are developing. The decompiler of IntelliJ IDEA was not built with this kind of usage in mind. You can see the decompiled java files for that jar. Navigate to the desired class or package. Search for jar name that you added in the previous step. Go to the Project tool window shown on the left. Add the jar you want to decompile in libraries by clicking the + symbol.
Go to Project structure settings > Libraries.
You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields. JD-GUI is a standalone graphical utility that displays Java source codes of. Open an existing project or create a new one. The Java Decompiler project aims to develop tools in order to decompile and analyze Java 5 byte code and the later versions. If you don't have IntelliJ products installed, either download it now (available on ) or make your own decompiler executable from sources (available on Github). Java -cp fernflower.jar. -hdc=0 -dgs=1 -rsy=1 -lit=1. is the class that contains the main method to run the decompiler. However something like this works: java -cp fernflower.jar. + This JAR is not executable, so we can't run it using java -jar. Copy it somewhere and rename to fernflower.jar (optional).Locate the file in $\plugins\java-decompiler\lib\java-decompiler.jar (example: C:\Program Files\JetBrains\IntelliJ IDEA 2018\plugins\java-decompiler\lib).IntelliJ IDEA comes with Java Bytecode Decompiler plugin (bundled) which is a modern extension of Fernflower. If you have any IntelliJ product installed, chances are that you already have the Fernflower decompiler on your computer. People ask me: How do I get the fernflower.jar? class files (it doesn't explode the jar).
Allowed file extensions are class, zip and jar.Įxample: java -jar fernflower.jar -hdc=0 -dgs=1 -rsy=1 -lit=1 c:\Temp\binary\ -e=c:\Java\rt.jar c:\Temp\source\īe aware that if you pass it a ".jar" file for the source, it will create another ".jar" file in the destination, however, within the new ".jar" file, the files will be. : file or directory with files to be decompiled. Or see an excerpt from the instructions below. To use the IntelliJ Java decompiler from the command line for a jar package follow the instructions provided here:įollow instructions for IntelliJ JD plugin. (you will get the wrong Usage command, but it does work).
Instead you can use the following command (from a Mac install): java -cp "/Applications/IntelliJ IDEA.app/Contents/plugins/java-decompiler/lib/java-decompiler.jar". The jar file is called java-decompiler.jar and does not include a main manifest. The decompiler can also debug your code, so you can use breakpoints anywhere in the decompiled code.As of August 2017 and IntelliJ V2017.2, the accepted answer does not seem to be entirely accurate anymore: there is no fernflower.jar to use. The bytecode viewer provides basic syntax highlighting, and it shows the information in a way that is comfortable for reading. Open a compiled file in the editor and select View | Show Bytecode from the main menu. If necessary, you can open the bytecode viewer for any compiled class. Show bytecode for compiled filesīy default, the IDE shows you decompiled code in compiled files. The yellow notification panel above the editor informs you that you’re reading a decompiled file. If you change your mind and want the JetBrains Decompiler dialog to appear again, disable the Java Bytecode Decompiler plugin in settings and open any compiled file in the editor.Īfter that the IDE will show you the human-readable Java code without actually converting. If you click Accept, the dialog will not be displayed in the future and the appropriate code will be automatically decompiled. If it's the first time that you're opening a compiled file, the IDE prompts you to agree to the specified terms and conditions in the JetBrains Decompiler dialog. IntelliJ IDEA features the Java bytecode decompiler that shows you compiled bytecode as if it were human-readable Java code.
For more information, refer to Install plugins. Make sure that the Java Bytecode Decompiler and Bytecode Viewer bundled plugins are enabled.