Obtaining, Compiling and Running the Examples
Prev | Chapter 3. Examples | Next

## Obtaining, Compiling and Running the Examples

The examples source code is part of the AspectJ distribution which may be downloaded from the AspectJ project page ( http://eclipse.org/aspectj ).

Compiling most examples is straightforward. Go the ``InstallDir`/examples` directory, and look for a `.lst` file in one of the example subdirectories. Use the `-arglist` option to `ajc` to compile the example. For instance, to compile the telecom example with billing, type

    ajc -argfile telecom/billing.lst

To run the examples, your classpath must include the AspectJ run-time Java archive (`aspectjrt.jar`). You may either set the `CLASSPATH` environment variable or use the `-classpath` command line option to the Java interpreter:

    (In Unix use a : in the CLASSPATH)
    java -classpath ".:InstallDir/lib/aspectjrt.jar" telecom.billingSimulation

    (In Windows use a ; in the CLASSPATH)
    java -classpath ".;InstallDir/lib/aspectjrt.jar" telecom.billingSimulation

Prev | Up | Next
Chapter 3. Examples | Home | Basic Techniques