Copyright © 2003 Eclipse.org. All Rights Reserved

Adding a Class to Your Project

 

Select the project you just created in the package explorer, and from the context menu select “new… -> class.”  Name the class “HelloWorld” and select the option to let Eclipse create a new main method for you. Click ok.

 

Edit the text in the editor so that it looks something like this:

 

/*

 * Created on 20-Aug-2003

 *

 * To change this generated comment go to

 * Window>Preferences>Java>Code Generation>Code and Comments

 */

 

/**

 * To change this generated comment go to

 * Window>Preferences>Java>Code Generation>Code and Comments

 */

public class HelloWorld {

 

      public static void main(String[] args) {

            new HelloWorld().sayHello();

      }

     

      public void sayHello() {

            System.out.println("Hello");

      }

}

 

Save the file.

 

Notice that unlike in a Java project, there was no eager parsing of the buffer as you typed (the outline view didn’t update), and no automatic compilation on save (instructions for turning on incremental compilation are given later in this tutorial). Your Eclipse should be looking something like this:

 

 

 

To build the project, click the AspectJ build button…

 

 

When the build completes, the outline view should be populated.