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


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/



Fabio Fagundes Silveira <ffs@xxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

25/10/2006 14:52

Please respond to
aspectj-users@xxxxxxxxxxx

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
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top