some puzzles about Openjdk
Liu lianshun
lsliu0507 at gmail.com
Wed Apr 8 17:32:30 UTC 2009
----- Original Message -----
From: "Patrick Wright" <pdoubleya at gmail.com>
To: "Liu lianshun" <lsliu0507 at gmail.com>; <build-dev at openjdk.java.net>
Sent: Wednesday, April 08, 2009 10:58 PM
Subject: Re: some puzzles about Openjdk
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
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
I've read the article written by Simonis. But the question solved in that article is different from mine.
I want to change the Java Apps' behavior only via changing the source codes of the openjdk, though
it may has some drawbacks, such as will not correctly execute the other apps.
I have another question that, when running an app, we type "java app" on command line, I want to
know that during the running process, what functions of VM are called, and the call relations. Thanks :)
Best regards,
Lianshun Liu
More information about the build-dev
mailing list