some puzzles about Openjdk

Alan Bateman Alan.Bateman at Sun.COM
Wed Apr 8 14:30:46 UTC 2009


Liu lianshun wrote:
> Hi, Dalibor Topic
>
> Thanks very much for your reply.
> My first question is that, I want to change the java application's behavior, in the other words, manipulate the bytecodes of some class when running the application without changing the class file itself. Is it possible? Can this be done via hacking on the  VM, and how? Thanks :)
>
> Bestwishes
> Lianshun Liu
>   
An alternative to hacking the VM is to use a java agent (see 
java.lang.instrument) or a JVM TI agent. These APIs are designed for 
instrumentation purposes but could be used for load-time hacking or 
redefining classes at runtime. These APIs are often used in conjunction 
with bytecode manipulation libraries like BCEL.

-Alan.



More information about the build-dev mailing list