r/javahelp • • Feb 23 '22

Bytecode editor?

I'm aware that class files are a binary format but I want to be able to edit class files and have the corresponding bytecode generated for me. So basically just open up a jar and edit a ClassFile and have the jar updated to match. Does such a tool exist?

0 Upvotes

8 comments sorted by

View all comments

3

u/wildjokers Feb 23 '22

Why?

1

u/Mysterious-Trick-562 Feb 23 '22

Just so I can edit random jars that I don't have the source of. Good way to learn about JVM stuff

1

u/sr1729 Feb 24 '22

You can edit .class files with a hexeditor. Have a look at a list of bytecodes and you will see the instructions in the class file when compared with the instruction listing of javap.

But beware: This is a hard way and seldom reasonable. It is not a good way to learn JVM stuff.