How can I open Java .class files in a human-readab

2020-01-25 12:44发布

I'm trying to figure out what a Java applet's class file is doing under the hood. Opening it up with Notepad or Textpad just shows a bunch of gobbledy-gook.

Is there any way to wrangle it back into a somewhat-readable format so I can try to figure out what it's doing?

  • Environment == Windows w/ VS 2008 installed.

17条回答
祖国的老花朵
2楼-- · 2020-01-25 13:03

jd-gui is the best decompiler at the moment. it can handle newer features in Java, as compared to the getting-dusty JAD.

查看更多
一纸荒年 Trace。
3楼-- · 2020-01-25 13:08

If the class file you want to look into is open source, you should not decompile it, but instead attach the source files directly into your IDE. that way, you can just view the code of some library class as if it were your own

查看更多
姐就是有狂的资本
4楼-- · 2020-01-25 13:11

CFR - another java decompiler is a great decompiler for modern Java written i Java 6.

查看更多
Root(大扎)
5楼-- · 2020-01-25 13:13

cpuguru, if your applet has been compiled with javac 1.3 (or less), your best option is to use Jad.

Unfortunately, the last JDK supported by JAD 1.5.8 (Apr 14, 2001) is JDK 1.3.

If your applet has been compiled with a more recent compiler, you could try JD-GUI : this decompiler is under development, nevertheless, it generates correct Java sources, most of time, for classes compiled with the JDKs 1.4, 1.5 or 1.6.

DarenW, thank you for your post. JD-GUI is not the best decompiler yet ... but I'm working on :)

查看更多
老娘就宠你
6楼-- · 2020-01-25 13:14

Using Jad to decompile it is probably your best option. Unless the code has been obfuscated, it will produce an okay result.

查看更多
对你真心纯属浪费
7楼-- · 2020-01-25 13:17

You want a java decompiler, you can use the command line tool javap to do this. Also, Java Decompiler HOW-TO describes how you can decompile a class file.

查看更多
登录 后发表回答