Look Inside Compiled Code with Java Bytecode Decompiler
When something is there for us day after day, we tend to take it for granted. In IntelliJ IDEA, there are several features that many people don’t even notice, even as they use them all the time. One of these features is the Java bytecode decompiler.
The Java bytecode decompiler in IntelliJ IDEA is a built-in tool that allows you to read compiled bytecode as if it were human-readable Java code.
Let’s say you have a library packed in a .jar file. You just downloaded it from the Internet and don’t have the source code for it. How do you look inside and make sure it actually has what you need?
If you open a .class file in a text editor, you’ll only see the bytecode that sometimes makes little sense. However, if you open the same file in IntelliJ IDEA, the IDE shows you the human-readable Java code from your .jar, without actually converting .class files into .java files. The yellow notification panel above the editor informs you that you’re reading a decompiled file.
The decompiler can not only convert bytecode to Java code, but it can also debug it. This means you can use breakpoints anywhere in the decompiled code with almost the same experience that you’d normally have when you debug your source code.
Of course, you can always open the bytecode viewer for any compiled class. Open the necessary .class file in the editor in IntelliJ IDEA and then select View | Show Bytecode from the main menu. If you’re not seeing this option, make sure that the bundled Bytecode Viewer plugin is enabled.
The bytecode viewer provides basic syntax highlighting, and it shows the information in a way that is comfortable for reading.
The decompiler works in both IntelliJ IDEA Ultimate and IntelliJ IDEA Community Edition. It is powered by the Java Bytecode Decompiler plugin, which is bundled and enabled by default.
This tool has been a part of IntelliJ IDEA for ages. So if you already have the IDE, give it a try and let us know what you think in the comment section. If you don’t have IntelliJ IDEA yet, grab a build or stay tuned for more news, because very soon we’re releasing IntelliJ IDEA 2020.1, which features our Java bytecode decompiler together with a range of exciting features and updates.
Subscribe to Blog updates
Thanks, we've got you!