SDSU CS 683 Emerging Technologies
Spring Semester, 2003
Aspect Intro
    Lecture Notes Index    Next    
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 21-Jan-03

Contents of Doc 1, Aspect Intro

The AspectJ Programming Guide, by The AspectJ Team,
PDF version in aspectj-docs-1.0.6.tqz at:

HTML version at:

Doc 1, Aspect Intro Slide # 2

Aspect-Oriented Programming Intro

Resources & Links

Main Web Sites Aspect-Oriented Program Development Aspectj site Parc Research site on Aspect-Oriented Programming

AspectJCommand line Java Compiler + Browser

Go to download section of

The class will use version 1.0.6

Eclipse Plug-in version


Includes documentation and download

Doc 1, Aspect Intro Slide # 3

An Example

The Files
public class Hello
        public static void main(String[] args )
public aspect HelloAspect
        before() : call(static void main(String[]) )
                        System.out.println( "Start");


Doc 1, Aspect Intro Slide # 4
Running the Example (by Hand)

Compile the example

ajc @Hello.lst

Run the example

java Hello

Doc 1, Aspect Intro Slide # 5

AspectJ Browsers

AspectJ has it own Browser/IDE called AspectJ Browser

AspectJ has support for

See for download information

Doc 1, Aspect Intro Slide # 6

AspectJ Browser

A minimal browser

Download at and click on Downloads Compiler and Browser AspectJ Documentation

See Documentation section

In particular look at:

Short instructions for Installing AspectJ Browser

Download the aspectj-tools-1.0.6.jar file

Install by using the command:

java –jar aspectj-tools-1.0.6.jar

In the directory created there is a file README-TOOLS.html

Follow the directions in that file to finish installation.

Doc 1, Aspect Intro Slide # 7
AspectJ Browser on Rohan

Installed in /home/ma/whitney/aspectj1.0

To use

Add to your classpath:

Add to your path: /home/ma/whitney/aspectj1.0/bin

Start the browser with the command:


Doc 1, Aspect Intro Slide # 8
Sample Use of AspectJ Browser

In a directory, called example, create two files

With the contents:

public class Hello 
   public static void main(String[] args)

Doc 1, Aspect Intro Slide # 9
Running the Browser

Start the browser with the command ajbrowser

Load the Hello.lst file by:

Build the project by clicking and holding on the build icon.

Select the project you wish to build

The browser should look like:

Doc 1, Aspect Intro Slide # 10
What does the browser do?

The compiled code is placed in the directory you started the browser in

To change this click on the Options icon and set the “Output path” in the AJBrowser Options panel

Doc 1, Aspect Intro Slide # 11


An open extensible IDE for anything and nothing in particular

Open source IDE from IBM

Becoming popular for Java development

AspectJ claims to require version 2.0

Main web site:


You can download Eclipse 2.0 at:

On Window download the correct file and unzip it.

In the eclipse directory run the eclipse.exe file

Documentation is at:

Doc 1, Aspect Intro Slide # 12
Eclipse and AspectJ

Main web page for using AspectJ in Eclipse

Installing AspectJ in Eclipse
Go to:


Unzip the files

This creates two directories

Follow the instructions in org.eclipse.ajdt.ui_0.5.2\releaseNotes\readme.html

Doc 1, Aspect Intro Slide # 13

Aspect S

Included in VisualWorks 7

See goodies/other/AspectS in the VisualWorks 7 directory

Read the file goodies/other/AspectS/Readme.txt for installation instructions

Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 21-Jan-03    Next