03-60-440 Principles of Programming Languages

School of Computer Science, University of Windsor

 

[Home]
[Up]

AspectJ Installation Instruction

You can run AspectJ programs either in command line or in IDEs such as Eclipse.

Installing command line AspectJ

Download

AspectJ can be downloaded from eclipse at here. You can choose the latest stable release, which is aspectj-1.7.4.jar as of November 2013. Start the installation by typing the command as below:

java -jar aspectjVersionNumberToBeReplaced.jar

It will start installation dialogues, prompting the version of JDK you want to use and installation directories.

Setup

Programs written is the AspectJ language are compiled using ajc. In order to use the compiler you have to add <aspectj install dir>/lib/aspectjrt.jar to your CLASSPATH environment variable and <aspectj install dir>/bin to your PATH.

To change those environment variables, use Control Panel/System/Advanced/Environment Variables/System Variables.

Compile and run the program

 >ajc Hello.java With.aj

Note that there is no comma in beterrn Hello.java and With.aj

 >java Hello

Installing AspectJ in Eclipse

To add AspectJ in Eclipse, select

Help/Software updates/Find and install/

Then select "Search for new features to install", then "new remote site".  In the URL box type" http://download.eclipse.org/tools/ajdt/37/update".

Upon successful installation, you can create a aspectJ project, and you can add aspects.

  • To create aspectJ projects, select file/new/others/aspecjtJ project. If you can't do this,  AspectJ is not installed properly.

  • To create an aspect, right click your project/new/other fold/aspect.
  • To set tiny.jar class path, right click your project/properties/java build path/ add external jars/select tiny.jar in your directory.
Jianguo Lu   Email: jlu at uwindsor,  Office: LT5111