Is it possible to view a Java class files bytecode [duplicate]

戏子无情 提交于 2019-11-27 21:43:29

问题


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.



来源:https://stackoverflow.com/questions/16774744/is-it-possible-to-view-a-java-class-files-bytecode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!