Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Load Time Weaving


OK I got it going following that, thanks Andy!


Note to the unwary: Java of course doesn't know what a backslash is and the java command doesn't eat whitespace after the semi colon here-

javaagent:pathto/aspectjweaver.jar MyPlainJavaProgram



On 5/26/2012 6:50 PM, Andy Clement wrote:
On 25 May 2012 14:43, trhouse<trhouse@xxxxxxxxx>  wrote:
Newbie here. I just need a sanity check here on LTW. Here is what I think
ought to happen

Given a properly constructed aspect and a properly configured and placed
aop.xml, I can run any java program which has been compiled by regular old
javac and have LTW apply aspects against it at runtime.
Yep.

To achieve the above I have to do the all and only the following (aside from
compiling the aspect with ajc and writing aop.xml):

make certain that the classpath for regular old java program includes:

jar://<path to aspectJ>aspectj1.6/lib/aspectjrt.jar!/
<path to compiled aspects>
<path to aop.xml containing META-INF folder>

and for VM options include:
-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader
I wouldn't do it that way.  I'd use the agent:

java -javaagent:pathto/aspectjweaver.jar MyPlainJavaProgram

You should just need the java code and aspect code (and META-INF
folder) on the classpath.

cheers,
Andy
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top