Java: Is there a way to obtain the bytecode for a class at runtime?
- by Adam Paynter
In Java, is there a way (at runtime) to obtain the bytecode which defined a particular class?
Put another way, is there a way to obtain the byte[] array passed to ClassLoader.defineClass(String name, byte[] b, int off, int len) when a particular class was loaded? I see that this method is declared final, so creating a custom ClassLoader to…