In this quick guide, you will learn how to decompile a .class file into a .java file. So let the decompilation begin.

Java is one of the most popular languages. It is cross-platform, robust and very popular in the industry. The cross-platform thing archived using a class file that is platform-independent. So instead of directly compiling its program code to machine-dependent code, It first compiles it to Bytecode, Which produces a .class file then that is compiled to machine-dependent code and gets executed in the JVM.

Decompiling a java .class file into a .java file

To convert the file, we need a decompiler. There are many options available to choose from but in this on we are going to use CFT decompiler. It is reliable and easy to use and supports almost all JDK versions.

You can download it using the link given below. This will download a .jar file which we will use for decompiling.

Download Java Decompiler

After downloading the decompiler, Now place the class file and compiler into a folder for the convenience and open up the terminal. You can also use your command prompt if you are on Windows and CD to the folder an run the below command :

java -jar cfr-0.14x.jar Class-file.class >

Above replace the Class-file with the actual file name and hit the enter key. This will generate a .java file, containing the actual code.

Alternatively, You can also use an online tool for the decompilation. Visit the given site for the same.

Online Java Decompiler

On this website. you can simply upload the .class file and it will do the job for you then you can download the converted .java file

Follow this video guide for step-by-step easy understanding

So that was it, I hope you liked the guide on how to decompile a class file into java file. Let me know your thoughts on this in the comment section below.