Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] lauching applications from another one with load-time weaving

Hi Matthew,

   Ok ... but how to get this working?  I just can get this working if I type: java -javaagent:xxx Test ... Therefore, I dont know how to load the other application (e.g. from App1.main) using a separate class loader ... :-(

  Would you please send me some hints (piece of code)?

Thank you,
Fabio

On Thu, 26 Oct 2006 16:07:14 +0100, Matthew Webster wrote

> Fabio,
>
> If you are using Java 5 then just use the -javaagent that comes with AspectJ: http://www.eclipse.org/aspectj/doc/released/devguide/ltw-agents.html. You may want to load you test application using a separate class loader, with it's own classpath. As each class is loaded it will automatically get passes to AspectJ.
>
> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM Hursley Park, Winchester,  SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> http://w3.hursley.ibm.com/~websterm/

>
>

> To
aspectj-users@xxxxxxxxxxx

> cc

> Subject
[aspectj-users] lauching applications from another one with        load-time weaving

>

>

>
> Hello,
>
>   To launch an application from another java program is possible using
> reflection, such as:
>
> Class cls = Class.forName("Test");
> String s[] = new String[] {};
> Object arguments[] = new Object[] { s };
> Method mainMethod = cls.getMethod("main", new Class[] {s.getClass()});
> Object result = mainMethod.invoke(null, arguments);
>
>  Ok, but how to do that (ie. launching "Test" application) using
> load-time weaving? I meant, lauching Test and aspects defined to be
> applied to this class in a META-INF/aop.xml file?
>
>  I've tried to find out any WeavingAdaptor tutorial or something like
> that ... but I didn't  ... :-(
>
>  Could you help me?  :-)
>
> Regards,
> Fabio


Back to the top