Obtaining, Compiling and Running the Examples

The examples source code is part of AspectJ's documentation distribution which may be downloaded from the AspectJ download page.

Compiling most examples should be 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