blob: 43868a2e2369a9a60edf40742cafc20e1618bd30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
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
|