Java bytecode edit tool set
2010-12-12 20:14
766 查看
There are 2 tool set combinations for java bytecode editing.
1. ASM + JASMIN
First use ASM to disassemble the bytecode class file to assemble file.(see command line under ASM folder)
Then use JASMIN language specification to rewrite this class file and then compile this class file.(see command line under Jasmin folder)
Specification: http://jasmin.sourceforge.net/instructions.html
Advantage:
These 2 tools are very update-to-date, less risk for class file format compatibility.
Disadvantage:
We'll have a lot of work to do for using these 2 tools.
2. Java ByteEdit for our manipulation: (JBE Editor)
Just run jbe.bat in JBE folder and use the GUI to do that.
jbe.bat
Advantage:
Easy to use, quick for test.
Disadvantage:
Not very update-to-date, we may have a risk for class file format compatibility issue.
----------------------------------------------------------------------------------------------------------------
Tool download URL and their documenation URL:
ASM: http://asm.ow2.org
JASMIN: http://jasmin.sourceforge.net/
JBE: http://jbe.sourceforge.net/
----------------------------------------------------------------------------------------------------------------
Simple introduction for each tool listed as above:
ASM:
-------------------
1. Feature description:(From Java class file to bytecode assembly language)
java -classpath "asm.jar;asm-util.jar;yourjar.jar" org.objectweb.asm.util.TraceClassVisitor org.domain.package.YourClass
or
java -classpath "asm.jar;asm-util.jar" org.objectweb.asm.util.TraceClassVisitor org/domain/package/YourClass.class
TOTAL EXAMPLE:
SET CP="E:/Resource/ASM/asm3.3lib/asm-3.3.jar;E:/Resource/ASM/asm3.3lib/asm-util-3.3.jar"
SET CP=%CP%;"E:/Resource/Test"
java -classpath %CP% org.objectweb.asm.util.TraceClassVisitor HelloWorld > HelloWorld.asm
2. You could get more on this project by looking into the following URL:
http://asm.ow2.org/doc/tutorial-asm-2.0.html
-----------------------------------------------------------------------------------------------------------------
JASMIN:
1.Usage: (From disasessmbly language to java bytecode)
Include the jar files under the lib directory and then run the following command line:
java -jar jasmin.jar examples/HelloWorld.j [Windows]
or
java -jar jasmin.jar examples/HelloWorld.j [Unix/MacOsX]
2. You could get more on this project by looking into the following URL:
http://en.wikipedia.org/wiki/Jasmin_(Java_assembler)#Invoking
http://jasmin.sourceforge.net/
-----------------------------------------------------------------------------------------------------------------
JBE:
1. Usage: (Change java bytecode in disassemble mode directly)
Just run jbe.bat in JBE folder and use the GUI to do that.
2. If you want to know more about JBE, please take a look of the following site:
http://jbe.sourceforge.net/
------------------------------------------------------------------------------------------------------------------
Actually we can use ASM to manipulate the java assemble code directly with some self-coding, here based on our experience, I would like to say, JBE is the best tool for us to use.
1. ASM + JASMIN
First use ASM to disassemble the bytecode class file to assemble file.(see command line under ASM folder)
Then use JASMIN language specification to rewrite this class file and then compile this class file.(see command line under Jasmin folder)
Specification: http://jasmin.sourceforge.net/instructions.html
Advantage:
These 2 tools are very update-to-date, less risk for class file format compatibility.
Disadvantage:
We'll have a lot of work to do for using these 2 tools.
2. Java ByteEdit for our manipulation: (JBE Editor)
Just run jbe.bat in JBE folder and use the GUI to do that.
jbe.bat
Advantage:
Easy to use, quick for test.
Disadvantage:
Not very update-to-date, we may have a risk for class file format compatibility issue.
----------------------------------------------------------------------------------------------------------------
Tool download URL and their documenation URL:
ASM: http://asm.ow2.org
JASMIN: http://jasmin.sourceforge.net/
JBE: http://jbe.sourceforge.net/
----------------------------------------------------------------------------------------------------------------
Simple introduction for each tool listed as above:
ASM:
-------------------
1. Feature description:(From Java class file to bytecode assembly language)
java -classpath "asm.jar;asm-util.jar;yourjar.jar" org.objectweb.asm.util.TraceClassVisitor org.domain.package.YourClass
or
java -classpath "asm.jar;asm-util.jar" org.objectweb.asm.util.TraceClassVisitor org/domain/package/YourClass.class
TOTAL EXAMPLE:
SET CP="E:/Resource/ASM/asm3.3lib/asm-3.3.jar;E:/Resource/ASM/asm3.3lib/asm-util-3.3.jar"
SET CP=%CP%;"E:/Resource/Test"
java -classpath %CP% org.objectweb.asm.util.TraceClassVisitor HelloWorld > HelloWorld.asm
2. You could get more on this project by looking into the following URL:
http://asm.ow2.org/doc/tutorial-asm-2.0.html
-----------------------------------------------------------------------------------------------------------------
JASMIN:
1.Usage: (From disasessmbly language to java bytecode)
Include the jar files under the lib directory and then run the following command line:
java -jar jasmin.jar examples/HelloWorld.j [Windows]
or
java -jar jasmin.jar examples/HelloWorld.j [Unix/MacOsX]
2. You could get more on this project by looking into the following URL:
http://en.wikipedia.org/wiki/Jasmin_(Java_assembler)#Invoking
http://jasmin.sourceforge.net/
-----------------------------------------------------------------------------------------------------------------
JBE:
1. Usage: (Change java bytecode in disassemble mode directly)
Just run jbe.bat in JBE folder and use the GUI to do that.
2. If you want to know more about JBE, please take a look of the following site:
http://jbe.sourceforge.net/
------------------------------------------------------------------------------------------------------------------
Actually we can use ASM to manipulate the java assemble code directly with some self-coding, here based on our experience, I would like to say, JBE is the best tool for us to use.
相关文章推荐
- Error:Error converting bytecode to dex: Cause: java.lang.RuntimeException: Exception parsing classes
- javassit-a mean to manipulate the java bytecode of an application
- [转]Native Java Bytecode Debugging without Source Code
- CVE2012-1723 Java Field Bytecode Verifier Cache RCE分析
- [java bug记录] java.util.zip.ZipException: invalid code lengths set
- 深入了解Java ClassLoader、Bytecode 、ASM、cglib
- Java bytecode
- Typesafe DSLs in Java: Part 1 — Typesafe Bytecode
- Java Code To Byte Code
- 解决mysql-connector-java驱动编译时Dex cannot parse version 52 byte code...等错误
- Javassist: Java Bytecode Engineering Made Simple
- Java bytecode fundamentals
- android 安全讲座第二层 使用AndBug调试Android Java Bytecode
- Using Bytecode Outline to View Java bytecode in Eclipse
- Instrumenting Java Bytecode with ASM
- Set layout parameter in Java code
- Trace every instruction in java bytecode using BCEL
- Java Code To Byte Code - Part One
- Java Bytecode
- Java Bytecode Instructions List