© Copyright 1998 - 2000 XEROX Corporation. All rights reserved.
AspectJ Development Environment Support for Borland® JBuilderTM
Contents
1. Overview
2. IDE Window and AspectJ Structure View
3. AspectJ Console (JBuilder 3.5)
4. Setting up, compiling, and running Spacewar in JBuilder 4
5. Setting up, compiling, and running Spacewar in JBuilder 3.5
1 Overview
AspectJ Development Environment (AJDE) support for JBuilder is an extension to
Borland's JBuilder. AJDE for JBuilder will allow you to
- compile AspectJ and Java files within the IDE
- set up a compile configuration that determine which files will be passed
to the compiler
- browse the structure of your AspectJ program
2 IDE Window and AspectJ Structure View
The following figure demonstrates a typical view of AspectJ Support for JBuilder
running:
- The AspectJ Support for JBuilder buttons
- The "AJ" button opens the Structure View
- This button launches the AspectJ Support for AspectJ Console
- The "compile with ajc" button
- The "run" button
- The Structure View showing the structure for the currently selected class
- The Structure View displays the structure of the AspectJ program; here
we see that the "static around(Ship)" advice action affects 4
different methods on the "Ship" class. To navigate to
these methods simply double click their entries in the tree.
- The structure view navigation and auto-arrange buttons
- Since navigating the Structure View can cause you to jump between
files internet browser style "forward" and "back"
buttons are provided
- The auto-arrange button will tile the JBuilder window with the
Structure View window
3 AspectJ Console (JBuilder 3.5)
- Configuration tab
- This pane allows you to select the files that will be passed to the
compiler
- Messages tab
- This pane displays the compile command passed to ajc as well as the
corresponding output
- "Debug.java" removed from the files passed to ajc
- the "Debug.java" has been removed from the current
configuration. Once "OK" is clicked that file will no
longer be passed to the compiler.
4 Setting up, Compiling, and Running Spacewar in JBuilder 4
To set up the examples/spacewar example (available for download at the bottom
of the Download
Page)
you can use the following steps as a guideline:
Step 1: set up Spacewar as a JBuilder project
- Launch JBuilder 4
- In the "File" menu select "New Project..."
- Fill out the fields according to the following screenshot and then click
"Next >"
Step 2: adding "aspectjrt.jar" as a project library
- In the "Project wizard - Step 2 of 3" window under
"Required Libraries" select "Add".
- When the "Select One or More Libraries" dialog comes up click
"New...".
- In the "New Library Wizard" create the "AspectJ
Runtime" library using your corresponding "jbuilder4/lib/ext/aspectjrt.jar"
path by clicking the "Add" button.
- Click "OK" out of both dialog boxes, and then click
"Finish":
Step 3: adding sources to your project
- In the "Project Explorer (left and uppermost pane in the IDE) right
click on "Spacewar.jpr" and select "Add Files /
Packages...".
- Click the "Packages" tab.
- Select both "spacewar" and "coordination" by cntrl-clicking
them and click "OK".
Step 4: setting up the build configuration and compiling
- AJDE currently only supports one build configuration is taken from a file
called "Default.lst" in your project's root directory. If
you try to compile without this file AJDE will create it for you and you can
modify it accordingly.
Step 5: running the Spacewar example
- Before running please see the Note for java.awt Users.
- When the compile finishes, click "AspectJ Run" in the
"Tools" menu.
- If you have not selected a class to run, you will be prompted to do
so: click "OK" in the prompt dialog.
- In the "Project Properties" dialog that pops up select the
"Run" tab.
- In the "Main class: " selection click "..."
- open up the "spacewar" package, select "Game" and
click "OK".
- Click "AspectJ Run" again to run Spacewar.
5 Setting up, Compiling, and Running in JBuilder 3.5
To set up the examples/spacewar example (available for download at the bottom
of the Download
Page)
you can use the following steps as a guideline:
- launch JBuilder 3.5
- in the "File" menu select "New project"
- click "Browse" and locate the "aspectj/examples"
directory
- type "Spacewar.jpr" into the dialog box to save the project
file in that directory (note, since the Spacewar example uses both the
"spacewar" and "coordination" packages the project
is set up in the root examples directory) and click "Save" to
close the "New Project File" dialog box
- click "Finish"
- in the "Project" menu select "Project properties..."
- set the "Output path" entry to be the directory where you
want your classes to go
- in the "Source" tab select the entry and click
"Edit" (by default JBuilder will set this directory to be
"examples/src" which does not exist)
- once the "Select a path" dialog appears simply click
"OK" since this will select the "examples" directory
- click "OK" to close the "Project Properties"
dialog
- in the leftmost pane you will notice "Spacewar.jpr", right click
this and select "Add to project" in the popup, then "Add
class/package..." in the next popup
- <cntrl> click "spacewar" and "coordination" and
then click "OK";
this will add the two packages to your project
- open the AspectJ Support for JBuilder Console
- you can remove "Debug.java" (this aspect adds considerable
overhead to the compile) by clicking it, then click "OK" to save
the build configuration and close the console
- click the "Compile" button to compile the project
- open the Structure View to browse the structure of the program
- click the "Run" button to play Spacewar
- if you have not selected a class to run, you will be prompted to do
so: click "OK" in the prompt dialog, then
- in the "Project Properties" dialog that pops up select the
"Run" tab
- under "Application" click "Set..."
- open up the "spacewar" package, select "Game" and
click "OK"