Java 字节码查看与修改
2014-09-17 08:35
232 查看
JBE - Java Bytecode Editor
JBE is a bytecode editor suitable for viewing and modifying java class files. It is built on top of the open-source jclasslib bytecode viewer by ej-technologies. For verification and exporting the class files, JBE uses the the Bytecode Engineering Library by Apache's Jakarta project. JBE是一个字节码编辑器,适合查看与编辑java class文件。它是et-technologies公司开发的建立在开源的jclasslib bytecode viewer之上的。用来检验和导出字节码class文件的。JBE用Apache公司的Jakarta项目的BytecodeEngineering Library库。 JBE requires Java 1.5 to run.--JBE需要java1.5的环境运行,貌似我的1.7也可以哦! It uses the standard mnemonics for JVM opcodes as instruction names. Jumps are absolute, labels are shown as line numbers. The cases/targets of tableswitch and lookupswitch instructions should be preceded by a tab or a space.--它用了jvm标准的操作码助记符名称。跳跃是绝对的,标签显示为行号。例如tableswitch和lookupswitch目标指令前面是一个Tab制表符或者一个空格space。 Class names should be written using the Java class file format conventions, so java.lang.String becomes java/lang/String—类名按照java类文件格式惯例,所以java.lang.String类就变成了java/lang/String。 Type information is also written as they appear in class files (e.g. the descriptor I speficies an integer, [Ljava/lang/Thread; is an array of Threads, etc.).-->类型信息按照他们在类文件中样子写出来。例如描述给I变量指定为整型integer,[Ljava/lang/Thread是一个线程的数组等等。 To add a constant, method, interface or field, select the appropriate section in the left pane. A form for adding the appropriate attribute is displayed on the main pane.--> 选择软件左边面板中合适的章节可以添加常量,方法,接口或者字段。主面板显示了添加合适属性的表格。 To remove a constant, method, interface or a field, select it in the left pane. A delete button appears on the main pane.—>选中左边面板中的常量,方接口或者字段,主面板中出现一个删除按钮,可以删除他们。 To add or remove an exception select the method's exception table tab. There, a form is included for adding an exception. An exception can be removed via the delete button.-->想要添加或者移除一个异常,选中方法异常表标签,然后出现一个可以添加异常的表格。一个异常可以通过点击删除按钮的方法移除。 There is no global save, all changes are directly applied to the class file after adding/deleting/modifying attributes. To return to the original file, select the appropariate menu item or button ("Revert to original class file").-->没有全局的保存,在添加/删除/修改属性后,所有的改变直接应用到class文件。选中合适的菜单项或者按钮, 返回原始的文件。 Download: Java Bytecode Editor 0.1.1 Changes from 0.1b: fix for saving InvokeInterface instruction by Carl Rumachik |
public class HelloWorld{ public static void main(String args[]){ System.out.println("hello,world"); } }
启动cmd命令窗口
可以看到类文件没有错误编译运行通过,下一步我想通过直接修改字节码中的hello,world
打开jbe软件,打开编译出来的class文件
将"hello,world"换成“你好,世界",点击保存(save method)按钮
回到命令行直接运行刚刚的class文件查看输出是否已经如我们所料。
相关文章推荐
- java查看class字节码文件(有图)
- 查看Java文件对应的字节码
- java 对象占用内存查看 以及JVM级别 方法修改等
- java使用powermock修改字节码,对函数进行打桩。
- [原创]ASM动态修改JAVA函数之函数字节码初探
- 查看Java class文件的字节码
- 命令查看java的class字节码文件
- java查看字节码和jar文件命令
- Atitit.java 虚拟机的构成 与指令分类 与 指令集合 以及字节码查看工具javjap
- 记一次使用修改字节码的方法解决java.lang.NoSuchMethodError
- 查看与修改字节码,从而实现替换他人jar包中class文件的目的
- java基础(安装/调试/记事本编写/web-inf目录/配置JRE,tomcat/查看虚拟路径/修改tomcat默认端口号)
- Java查看字节码
- java 对象占用内存查看 以及JVM级别 方法修改等
- java 对象占用内存查看 以及JVM级别 方法修改等
- 命令查看java的class字节码文件
- java笔记--查看和修改线程的优先级
- 【JAVA】javap——字节码格式查看工具
- 命令查看java的class字节码文件、verbose、synchronize、javac、javap
- Java 动态代理与class字节码动态修改技术