AspectJ Development Environment support for NetBeans
Overview
AJDE for NetBeans enables you to:
- compile AspectJ and Java files within the IDE
- browse the structure of your AspectJ program
- set up a compile configuration that determine
which files will be passed to the compiler
Installation
- use the installer or directly place the module
jar and the "aspectjrt.jar" into the modules directory. The installer
will also provide the two html files "LICENCE-AspectJForNetBeans.html" and
"README-AspectJForNetBeans.html".
- start up, and in the "Tools" menu select
"Global Options"
- right-click the "Modules" item and select "New
Module from File..."
- find the module jar file in the directory that
you installed into (e.g. c:/NetBeans4j/modules) and select it
To uninstall follow NetBeans's documentation on un-installing modules, or
simply remove the file modules/aspectjForNetbeans.jar from NetBeans's
install directory.
Running AJDE for NetBeans
3.1 Setting up the AspectJ Examples (in NetBeans
3.3.1)
- in the "Project" menu select "Project Manager"
- Click "New..." and enter "AspectJ Examples" as
the projects' name and click "OK".
- In the "Filesystems" Explorer tab right click
"Filesystems", then select "Mount -> Local Directory".
- browse into the AspectJ install directory (e.g.
"C:/apps/aspectj1.0")
- select "examples" and click "Finish"
- In the "Tools" menu select "AspectJ -> Start
AJDE" or just click on the "AJDE" (
)
button (shown as label 1 of the screenshot).
3.2 Compiling the Spacewar Example
- After AJDE is started, a new "AspectJ" tab is
added to the explorer window. Click it. The next thing to do is to
choose a particular build, since there are many in the examples
distribution. To the right of the "Build" button (
)
there is a downward arrow. Click it, and select "spacewar/demo.lst" (as
in label 2 of the screenshot). This will start a build of the demo
configuration of spacewar. Clicking the "Build" button will rebuild.
- When the compile is finished and the "AspectJ
Explorer" structure is present navigate the structure by clicking nodes
(as shown in label 3 of the screenshot). Note that associations between
nodes appear with UML-style arrow icons and italicized names and
reperesent how a particular node in the structure relates to others. In
order to navigate these associations expand the notes and click the
corresponding links (in blue). These links represent structure nodes
elsewhere in the tree.
- If there are compilation errors, clickable
messages will appear (as in label 4 of the screenshot).
3.3 Running the Spacewar Example
- In the "Filesystems" Explorer tab open the
"spacewar" directory, right click "spacewar/Game.java", and the select
"Execute".
- When finished executing switch back to the
"Editing" mode.
- Select and build the "debug.lst" configuration
as described in 3.2 and execute again--you will notice that the debug
configuration adds a debug window used for tracing by including the
"Debug.java" aspect in the compile.
3.4 Debugging the Spacewar Example
- You must first add the filesystem to the
project so that the debugger can see the main class. Do this in the
"Project AspectJ Examples" tab in the explorer by right clicking the
root node and selecting "Add Existing...".
- You may now need to add the AspectJ Runtime to
the project so that the debugger can see it. In the same way as
described in 3.1 select "Mount -> Archive (JAR, Zip)".
- Browse to the your lib/ext/aspectjrt.jar file
within your NetBeans install directory and click "Finish".
- Select "Project -> Set Project Main Class..."
in the menu bar, browse to "spacewar/Game.java" in the examples
directory that you created and click "OK".
- In the "Filesystems" Explorer tab open the
"spacewar" directory, click "Game.java", and the select "Debug -> Strat"
from the menu bar.
AspectJ-related options can be modified in the AJDE settings window.
