Partner – Moderne – NPI EA (cat=Spring Boot)
announcement - icon

Refactor Java code safely — and automatically — with OpenRewrite.

Refactoring big codebases by hand is slow, risky, and easy to put off. That’s where OpenRewrite comes in. The open-source framework for large-scale, automated code transformations helps teams modernize safely and consistently.

Each month, the creators and maintainers of OpenRewrite at Moderne run live, hands-on training sessions — one for newcomers and one for experienced users. You’ll see how recipes work, how to apply them across projects, and how to modernize code with confidence.

Join the next session, bring your questions, and learn how to automate the kind of work that usually eats your sprint time.

Course – Black Friday 2026 – NPI EA – main – before_post_content
announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

Course – Black Friday 2026 – NPI – main – before_post_content
announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

1. Introduction

In this tutorial, we’ll discuss decompiling Java classes. When source code is not available, decompiling Java classes helps to debug and understand source code behavior.

Let’s take a look at the different options available.

2. Decompiling in IDE

Since most development is done in an integrated development environment (IDE), it makes sense that decompilation should also take place in an IDE.

For more info on the IDEs we will work with, check out our articles on how to debug in Eclipse and configuration for IntelliJ IDEA.

2.1. Eclipse

Firstly, in Eclipse we need a plugin such as the Enhanced Class Decompiler (ECD). This plugin uses five different decompilers.  We can install it from the Eclipse Marketplace and then we need to restart Eclipse.

Next, ECD requires a small amount of setup to associate class files with the Class Decompiler Viewer:

Eclipse class

Also, we need to associate “.class without source” files:

Eclipse classWithoutSource

Finally, we can use the decompiler by pressing Ctrl+Left-Click on a class name. We see the decompiler used on the file tab in brackets.

In this example, we’re using FernFlower:

Eclipse

2.2. IntelliJ IDEA

In contrast to Eclipse, IntelliJ IDEA provides the FernFlower decompiler as a default.

To use it, we simply Ctrl+Left-Click on a class name and view the code:

IntelliJIDEA

Also, we can download the source. Downloading the source will provide the actual code and comments.

For instance, the Component annotation class from the above screenshot includes Javadoc on the use of Component. We can notice the difference:

IntelliJIDEA.2

While decompilation is very helpful, it doesn’t always give a complete picture. The full source code gives us a complete picture.

3. Command Line Decompiling

Before IDE plugins, the command-line was used for decompiling classes. Command-line decompilers can also be useful for debugging Java bytecode on a remote server that is not accessible with an IDE or GUI.

For example, we can decompile with JDCommandLine using a simple jar command:

java -jar JDCommandLine.jar ${TARGET_JAR_NAME}.jar ./classes

Don’t leave off the ./classes parameter. It defines the output directory.

After successful decompilation, we can access the source files contained in the output directory. They’re now ready to view through a text editor like Vim.

4. Conclusion

We looked at decompilation in Eclipse and IntelliJ IDEA IDEs as well as a command-line option when they aren’t available.

We also looked at the difference between linking source code and decompilation.

Partner – Moderne – NPI EA (tag=Refactoring)
announcement - icon

Modern Java teams move fast — but codebases don’t always keep up. Frameworks change, dependencies drift, and tech debt builds until it starts to drag on delivery. OpenRewrite was built to fix that: an open-source refactoring engine that automates repetitive code changes while keeping developer intent intact.

The monthly training series, led by the creators and maintainers of OpenRewrite at Moderne, walks through real-world migrations and modernization patterns. Whether you’re new to recipes or ready to write your own, you’ll learn practical ways to refactor safely and at scale.

If you’ve ever wished refactoring felt as natural — and as fast — as writing code, this is a good place to start.

Course – Black Friday 2026 – NPI EA – main – after_post_content

announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW

Course – Black Friday 2026 – NPI – main – after_post_content

announcement - icon

Yes, we're now running our Black Friday Sale. All Courses are 33% off until 1st December, 2026 at 17:00 Romania time:

>> EXPLORE ACCESS NOW