I want to be able to edit bytecode and recompile into executable class files. I have no idea how to do this. I have tried decompiling with javap -c and -v, edit something, and change it back to my Class file, but I get an error "Error: Could not find or load main class Test.class". I would also like to generate java source from the bytecode. Any help? I want to do this myself without the use of outside programs. I want to do it myself if at all possible.
The output from javap
is not suitable input for an assembler. If you want to disassemble and reassemble Java bytecode, you will need to do one of the following:
I would take a look at Soot and Krakatau, both of which have full (dis)assembling capabilities. Soot supports a handful of intermediate representations for bytecode. Krakatau, I believe, uses a representation based on the popular Jasmin (though the tool itself is written in Python).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With