| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <title> |
| Creating your first AspectJ project |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| </head> |
| <body> |
| <h1> |
| Creating your first AspectJ project |
| </h1> |
| <p> |
| In this section you will create a new AspectJ project and add a package and a Java class to your project. |
| </p> |
| |
| <OL> |
| |
| <LI>Inside Eclipse select the menu item <STRONG>File > New > |
| Project...</STRONG>. to open the <STRONG>New Project</STRONG> wizard.</LI> |
| <LI>Select <STRONG>AspectJ Project</STRONG> then click <STRONG>Next</STRONG>. |
| On the next page, type "Hello World" in the <STRONG>Project name</STRONG> |
| field and click <STRONG>Finish</STRONG>. |
| <P><img src="../images/newajproject.png" alt="New AspectJ Project Wizard"></P> |
| The Java perspective opens inside the workbench with the new AspectJ project in the Package Explorer. |
| </LI> |
| <LI>Select the "Hello World" project in the package explorer then select <STRONG>File |
| > New > Package...</STRONG>. to open the <STRONG>New Java Package</STRONG> wizard. Type |
| "helloworld" in the name field and click finish. |
| </LI> |
| <LI>Select the package that you just created in the package explorer then select <STRONG>File |
| > New > Class...</STRONG>. to open the <STRONG>New Java Class</STRONG> wizard. Type |
| "Hello" in the name field, select the option to allow Eclipse to create |
| a main method and click finish. |
| <P><img src="../images/newclass.png" alt="New Java Class Wizard"></P> |
| </LI> |
| <LI>Type the following into your new class. |
| <P><code> <br> |
| public static void main(String[] args) {<br> |
| sayHello();<br> |
| } <br><br> |
| public static void sayHello() {<br> |
| System.out.print("Hello");<br> |
| }<br> |
| |
| </code></P> |
| </LI> |
| <LI> Save the file. </LI> |
| </OL> |
| |
| <p> |
| <img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27"> |
| </p> |
| <p> |
| <a href="../concepts/projects.htm">AspectJ projects</a><br> |
| <a href="../concepts/perspectives.htm">AspectJ perspectives</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159"> |
| </p> |
| <p> |
| <a href="../tasks/newajproject.htm">Creating a new AspectJ project</a><br> |
| <a href="../tasks/convertjavaproject.htm">Converting a Java project to an AspectJ project</a><br> |
| </p> |
| |
| </body> |
| </html> |