我正在尝试弄清楚Java applet的类文件在幕后做什么。用记事本或Textpad打开它,只会显示一堆乱七八糟的东西。
有没有办法把它还原成某种可读的格式,这样我就可以试着弄清楚它在做什么?
已安装
发布于 2008-09-16 20:11:27
jd-gui是目前最好的反编译器。与刚刚起步的JAD相比,它可以处理Java中的新特性。
发布于 2008-09-16 20:08:16
如果你不介意读字节码,javap应该可以工作的很好。它是标准JDK安装的一部分。
Usage: javap <options> <classes>...
where options include:
-c Disassemble the code
-classpath <pathlist> Specify where to find user class files
-extdirs <dirs> Override location of installed extensions
-help Print this usage message
-J<flag> Pass <flag> directly to the runtime system
-l Print line number and local variable tables
-public Show only public classes and members
-protected Show protected/public classes and members
-package Show package/protected/public classes
and members (default)
-private Show all classes and members
-s Print internal type signatures
-bootclasspath <pathlist> Override location of class files loaded
by the bootstrap class loader
-verbose Print stack size, number of locals and args for methods
If verifying, print reasons for failure
发布于 2018-02-16 23:51:07
正如@MichaelMyers所指出的,使用
javap -c <name of java class file>
来获取JVM汇编代码。您还可以将输出重定向到文本文件,以获得更好的可见性。
javap -c <name of java class file> > decompiled.txt
https://stackoverflow.com/questions/76314
复制相似问题