简体   繁体   中英

How to decompile a Java .class file from rt.jar

I have extracted a .class file from the rt.jar file in jre1.7, and have attempted to open it using notepad++, however it is unreadable. How can I decompile the .class file into a .java file so I can view the code?

Please note that I am interested in the decompilation of the code, not viewing the source code provided in the JDK downloads.

As @Jon Skeet said, don't use JRE but JDK, which contains the entire source code. If you for some reason insist on your approach, then I recommend JD-GUI for decompilation.

.class files are the compiled binary files. You can't read the Java code from them, but you can run them. If you want to see the source you usually need .java files. These are either packed in the same jar but then the src folder, or they can be downloaded in a seperate package.

You can use any decompiler tool like cavaj for decompiling a class file to source code (java file). I'm using it, and it works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM