| |
| For users of JDK 1.4 the bin directory of your AspectJ distribution |
| contains a script "aj" to perform load-time weaving. Java classes on |
| the CLASSPATH are loaded and woven with aspects also on the CLASSPATH |
| which are declared in an aop.xml file. This file is either created by |
| the user or generated by the compiler. Alternatively aspects can be |
| loaded from an explicitly defined ASPECTPATH. |
| |
| For users of JDK 1.5 the bin directory of your AspectJ distribution |
| contains a script "aj5" to perform load-time weaving using an agent. |
| This uses an aop.xml as described above. |
| |
| --To compile the HelloWorld program-- |
| |
| ajc -outjar hello.jar HelloWorld.java |
| |
| --To compile the Tracing aspect-- |
| |
| ajc -outjar tracing.jar -outxml Tracing.aj |
| |
| --To run the example-- |
| |
| set CLASSPATH to include hello.jar |
| |
| aj HelloWorld |
| |
| --To run the example with tracing-- |
| |
| set CLASSPATH to include "tracing.jar" |
| |
| aj HelloWorld |
| |
| --To run the example with tracing using ASPECTPATH-- |
| |
| set ASPECTPATH=tracing.jar |
| |
| aj HelloWorld |
| |
| --To run the example with tracing using an agent-- |
| |
| aj5 HelloWorld |
| |