Is there a java classfile / bytecode editor to edit instructions? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this questionIs there a utility (or eclipse plugin) for editing java class files? I'd like to manipulate the bytecode开发者_如何转开发 of a java class file without recompiling it nor having a complete buildpath.
E.g. to rename methods, add/delete instructions, change constants etc.
The only utilities I found are:
classeditor but it's very limited in functionality (e.g. renaming of things and manipulating instructions isn't possible).
jbe doesn't save changes (maybe because class verifying fails - before I made any changes, although the class runs perfectly)
(jbe initially had a classpath issue, adding the class path to the jbe.bat file helped)
I use reJ for editing class files directly.
It allows you to edit instructions, methods, constant pool, diff classes, and a split view with a hex editor.
It's ridiculously awesome.
I have not seen any byte code -> byte code frontends, but plenty backends.
I would suggest that you have a look at the many byte code manipulation libraries like javassist
which allow loading byte code, manipulate it, and save it back to disk, and then write a small main that does exactly that.
I wrote an open source Java assembler and dissasembler you may find useful.
It lets you disassemble a classfile into human readable assembly, edit it, and then reassemble it into a class. It was originally designed for writing obfuscated crackmes, so there are a lot of obscure features it supports that many other tools don't. If you need any features it doesn't currently support, feel free to contact me and I'll see what I can do.
Find this list of byte code manipulation/code generation libraries helpful?
精彩评论