Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] post-compilation weaving

Hi, I'm trying to take in some class files (or jar file with class files inside), use aspectJ to weave them and get the new class files, however I keep getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature

Basically I have three source files: MyClass.java, MyMain.java, MyAspect.java
I compiled MyClass.java and MyMain.java with javac, got MyClass.class and MyMain.class, put them in a jar file with a manifest file indicating MyMain contains main method:
   jar cmf mainfest.txt MyApp.jar *.class

I create MyAsp.jar using:
  ajc MyAsp.java -outjar MyAspect.jar

Then I use ajc to weave the class files in the jar file
   ajc -injars MyApp.jar -aspectpath MyAspect.jar -outjar MyAspectApp.jar

Then I run:
   java -classpath "MyAspect.jar" -jar MyAspectApp.jar  (also tried java -jar MyAspectApp.jar)

Then I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature

These three java files work fine when I use ajc to compile them together first then run MyMain.  I also noticed that if I jar the ajc-compiled class files all in a jar file, MyAspectApp2.jar, and run java -jar MyAspectApp2.jar, I also get this error.

I greatly appreciate any kind of help!! Thanks so much in advance.



Sent from the AspectJ - users forum at Nabble.com.

Back to the top