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

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.


> 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.