some puzzles about Openjdk
Patrick Wright
pdoubleya at gmail.com
Wed Apr 8 14:58:49 UTC 2009
On Wed, Apr 8, 2009 at 4:30 PM, Alan Bateman <Alan.Bateman at sun.com> wrote:
> Liu lianshun wrote:
>> 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 :)
> 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.
Here's a nice, recent blog entry about various alternatives to
manipulating bytecode on-the-fly, might give you some ideas
http://weblogs.java.net/blog/simonis/archive/2009/02/we_need_a_dirty_1.html
Patrick
More information about the build-dev
mailing list