I am working on a bytecode manipulation/generation in Java and I was just wondering if there is an easy way I could check the bytecode. I do not want to decompile the file, I would like to actually look at the compiled bytecode. I do not need to edit it. Any links or programs for doing this would be acceptable answers.
问题:
回答1:
I've been working on a decompiler that has a color-coded bytecode output mode (which I find far more readable than javap). It can also output Java code or an intermediate 'bytecode AST'.
回答2:
Since you wanted to be guided to some program that can easily show you the byte code then my suggestion is to use IntelliJ IDEA since it has built-in support for viewing byte code.
Here's an example how to do it (it can also be mapped to some keys of your choice):
It is very easy, and it can surely be done in eclipse or NetBeans as well.
回答3:
Not sure what exactly you need, but apart from javap
, which is a command-line tool for displaying the bytecode, you can take a look at javassist, asm and cglib - they allow you to parse the bytecode with java code.
回答4:
The javap
command-line tool, which is bundled with Oracle's JDK, gives a detailed textual dump of .class files along with the constant pool and all functions' bytecode content. Just run it with -v
to get a full dump.