aboutsummaryrefslogtreecommitdiffstats
path: root/docs/devguide/aj.adoc
blob: 2aa2c2c6e8de6ef25c6d21d29bc8054e43b48b1b (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
= `aj`, the AspectJ load-time weaving launcher

== Name

`aj` - command-line launcher for basic load-time weaving

== Synopsis

[subs=+quotes]
aj [_Options_] [_arg_...]

[[aj]]
== Description

The `aj` command runs Java programs in Java 1.4 or later by setting up
`WeavingURLClassLoader` as the system class loader, to do load-time
bytecode weaving.

The arguments are the same as those used to launch the Java program.
Users should define the environment variables `CLASSPATH` and
`ASPECTPATH`.

For more information and alternatives for load-time weaving, see
xref:ltw.adoc#ltw[Load-Time Weaving].

== Examples

Use ajc to build a library, then weave at load time

[source, text]
....
REM compile library
${ASPECTJ_HOME}\bin\ajc.bat -outjar lib\aspects.jar @aspects.lst

REM run, weaving into application at load-time set
ASPECTPATH=lib\aspects.jar set CLASSPATH=app\app.jar
${ASPECTJ_HOME}\bin\aj.bat com.company.app.Main "Hello, World!"
....