Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] startUp problem

Hi

I am trying to write a simple helloworld program as my first AOP program. However, I keep on getting linking errors. There is no classpath error because the samples that come with aspectJ run successfully. I have taken the code from "I want my AOP-2" tutorial. as it says I have defined an aspect, and a class helloworld. 

//MannersAspect.java
public aspect MannersAspect
{
    HelloWorld hello=new HelloWorld();
    
         pointcut callSayMessage() : call(public static void HelloWorld.say*(..));
         before() : callSayMessage()
         {
             System.out.println("GoodDay!");
         }
         after(): callSayMessage()
         {
             System.out.println("Thankyou!");
         }
}

//HelloWorld.java
public class HelloWorld
{
   public static void say(String message)
   {
       System.out.println(message);
   }

   public static void sayToPerson(String message, String name)
   {
     System.out.println(name+ ", "+ message);
   }


}
It compiles fine. It gives me an error when I try to run the program saying
"MannersAspect.java": 'class' or 'interface' expected 


Please I will be ever so grateful if anyone of you could help me out. Please I really need help, and I don't have much time left as my deadline is approaching real fast. I am sure that you guys can easily help me out, as you must have gone through these initial startup phases as well.

thankyou so much
Hinna




Back to the top