IDEA查看字节码


在JDK工具包的bin目录下,有一个java可执行文件javap即javap.exe,该工具可以查看java编译后的class文件,使用命令javap -c Test.class。


IDEA中设置宏,来快捷使用javap查看字节码,设置如图:

Arguments:-c $FileNameWithoutExtension$.class

Working directory:$OutputPath$\$FileDirRelativeToSourcepath$

IDEA查看某个类对应的字节码文件

需要注意的是:查看某个类对应的字节码文件之前确保它已经被编译过