How can I open Java .class files in a human-readable way?

后端 未结 17 1983
傲寒
傲寒 2020-11-28 18:09

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 the

相关标签:
17条回答
  • 2020-11-28 18:48

    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 :)

    0 讨论(0)
  • 2020-11-28 18:48

    JAD is an excellent option if you want readable Java code as a result. If you really want to dig into the internals of the .class file format though, you're going to want javap. It's bundled with the JDK and allows you to "decompile" the hexadecimal bytecode into readable ASCII. The language it produces is still bytecode (not anything like Java), but it's fairly readable and extremely instructive.

    Also, if you really want to, you can open up any .class file in a hex editor and read the bytecode directly. The result is identical to using javap.

    0 讨论(0)
  • 2020-11-28 18:49

    There is no need to decompile Applet.class. The public Java API classes sourcecode comes with the JDK (if you choose to install it), and is better readable than decompiled bytecode. You can find compressed in src.zip (located in your JDK installation folder).

    0 讨论(0)
  • 2020-11-28 18:50

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

    0 讨论(0)
  • 2020-11-28 18:52

    jd-gui "http://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip&can=2&q=" is the best and user friendly option for decompiling .class file....

    0 讨论(0)
  • 2020-11-28 18:53

    what you are looking for is a java de-compiler. I recommend JAD http://www.kpdus.com/jad.html It's free for non commercial use and gets the job done.

    Note: this isn't going to make the code exactly the same as what was written. i.e. you're going to lose comments and possibly variable names, so it's going to be a little bit harder than just reading normal source code. If the developer is really secretive they will have obfuscated their code as well, making it even harder to read.

    0 讨论(0)
提交回复
热议问题