Hai
      I have implemented a class loader(not the one
provided with bcel) but in the java programming
language.I am using BCEL api to dynamically intercept
the loading process of class files and put in extra
instrumentation bytecodes.
1.Get the class file
2.Invoke bcel program which does instrumentation
3.turn them into bytes
4.call defineclass.

In the loadclass() function:

    JavaClass jclazz = new
ClassParser(classFilename).parse();

    InstrumentWithBcel insbcel = new
InstrumentWithBcel();           
        insbcel.instrumentClass(jclazz);
       byte raw[] = jclazz.getBytes();
    clas =
defineClass(jclazz.getClassName(),raw,0,raw.length);    

  Is this right way?In the instrumentation,the
bytecode injected is a static method call like
Instrument.invoke();

There are two problems:
1) the program is invoked as:
   java myloader HelloWorld and nothing is getting
inserted in the bytecodes.
2) When I am using programs like : abc.def.instrument
: like
java myloader abc.def.instrument arguments
I am assuming that all the bytecodes for a class(like
abc.def.Instrument.class) are in memory and after
inserting extra code   
like Instrument.invoke(),the executing class will
expect this Instrument.invoke() in current directory.
Can someone give me some pointers on how to handle
this issue?

Any advice is greatly appreciated...

Thanks
Ram




__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to