Question #71930

How can I open a .class file?

Expert's answer

A class file is in binary format. You can open and view it by any text editor like notepad in windows and vi in mac.
But to get the Java code from a class file, you can either use following:
Use a decompiler like Java Decompiler. For example:
javap –c YourClass. Then you will see disassembled source code

Use an IDE like Intelli-j with built-in decompiler
Use online decompiler such as www.javadecompilers.com
Now you can read the class file. But it will not be exact same as the source code from which it was compiled.
Source: https://www.quora.com/How-can-I-open-class-files-in-Java
LATEST TUTORIALS
APPROVED BY CLIENTS