Using javap I can disassemble a java class into byte code. If I want to run this byte code, or a modified version of it, how do I do it? Please spare me the "don't bother" answers as I am doing this for educational reasons. I've googled and looked at other Stack Overflow questions but couldn't find an answer.
+1
A:
Use ClassLoader.defineClass()
along with a custom classloader. The Javadoc page provides an example of almost exactly what you want to do.
Greg Hewgill
2009-07-10 12:56:13
A:
You can use a java dis-assembler to produce java code you can compile (perhaps with some fixing of the code by hand)
You can then modify the code and re-compile it.
Peter Lawrey
2009-07-10 13:16:28