-
1. Re: Byteman and static code injection. How to inject to class file?
adinn Oct 24, 2019 8:58 AM (in response to byteman_ask)1 of 1 people found this helpfulHi,
byteman_ask wrote:
But is it possible to inject code to class files permanently? I would like to inject some code to Java compiled class file and save changed file it in another location. How can I do that?
Sorry, I am afraid you cannot do that with Byteman. The changes it makes only work in the current JVM.
I don't know of any other tools that make it easy to do what you are asking unless you understand a lot about Java bytecode. Perhaps ByteBuddy will work? I don't really know it very well so I cannot say for certain. Otherwise you will need to look at bytecode rewriting tools like ASM or Javassist.
regards,
Andrew Dinn
-
2. Re: Byteman and static code injection. How to inject to class file?
byteman_ask Oct 25, 2019 10:16 AM (in response to adinn)Oh, that's a shame. For editing bytecode I'm mostly using Recaf (Releases · Col-E/Recaf · GitHub ) or JBE (JBE - Java Bytecode Editor ).
I thought that Bytaman can automatize some actions for me, but not in this case I suppose.