Monday, 13. October 2008
Hello World with PatternTesting
javatux, 22:25h

Now we are ready to create a simple Java project with a hello.World class inside:
package hello;
public class World {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

Next we will integrate the PatternTesting library. Download it from the download page and call the project properties. Select the entry "AspectJ Build" and then the tab "Aspect Path". Add the patterntesting.0.6.0.jar you have downloaded and press ok.

You should see now the warning No logging should be done using System.out! in the problems view. I don't know any program which needs to use System.out for printing so this warning is normally ok. One exception from this rule is this Hello-World program so you can suppress it using the anntoation @SystemOutNeeded:
package hello;
import patterntesting.java.annotation.*;
public class World {
@SystemOutNeeded
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
happy patterntesting...
... comment