Bug 92499 - Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/NoAspectBoundException
Summary: Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/N...
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 92500 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-23 16:33 EDT by Masroor Hussain CLA
Modified: 2005-08-26 11:23 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masroor Hussain CLA 2005-04-23 16:33:37 EDT
Sample Hello.java File
public class Hello{

        public static void main (String []args)          {
                say ("Hello World");

        }
        public static void say (String arg)   
        {
                System.out.println  (arg);
        }
}

sample Manners.java
public aspect Manners
{
        pointcut callsay ():call (* Hello.say (..));
        before (): callsay ()
        {
                System.out.println ("Welecome");
        }

        after (): callsay ()
        {
                System.out.println ("Good bye");
        }
}
////

I am using AspectJ1.1 and jdk1.3.1, when i compile them with ajc Hello.java 
Manners.java, it successfully create respected class files. but when i execute 
java Hello.java. I prompts me following error:
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/aspectj/lang/NoAspectBoundException
at Hello.main(Hello.java:6)

Also I tried the same steps with AspectJ1.5 and it also prompts me said Error.
Comment 1 Andrew Clement CLA 2005-04-25 07:55:54 EDT
When running code built with AspectJ you must ensure the aspectjrt.jar is on
your classpath.  It can be found in your <aspectjInstallDir>/lib folder.  This
jar contains the NoAspectBoundException class.
Comment 2 Andrew Clement CLA 2005-04-26 08:27:36 EDT
*** Bug 92500 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Clement CLA 2005-05-10 03:26:04 EDT
Is this resolved now?  Did you fix it by putting aspectjrt.jar on your classpath
when executing the program?
Comment 4 Adrian Colyer CLA 2005-08-26 11:23:47 EDT
I'm assuming the recommended solution fixed the problem. if not, please reopen.