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


aj [Options] [arg...]


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 Load-Time Weaving.


Example 2.5. A simple example

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

    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!"