blob: 6b8c2f04f81f9d6984ccaefedc12fbd4e8c27c8b [file] [log] [blame]
<!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 &gt; New &gt;
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 &quot;Hello World&quot; 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 &quot;Hello World&quot; project in the package explorer then select <STRONG>File
&gt; New &gt; Package...</STRONG>. to open the <STRONG>New Java Package</STRONG> wizard. Type
&quot;helloworld&quot; in the name field and click finish.
</LI>
<LI>Select the package that you just created in the package explorer then select <STRONG>File
&gt; New &gt; Class...</STRONG>. to open the <STRONG>New Java Class</STRONG> wizard. Type
&quot;Hello&quot; 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>
&nbsp;&nbsp;&nbsp;&nbsp; sayHello();<br>
} <br><br>
public static void sayHello() {<br>
&nbsp;&nbsp;&nbsp;&nbsp; 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>