Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LoadTime Weaving with aj.bat

Hi!

I might be wrong but the problem seems to be by using both -classpath and -jar. IIRC -jar is dismissing -classpath, and is only considering the classpath provided in the manifest.

./alex
--
.w( the_mindstorm )p.

#: Funkoholic@xxxxxx changed the world a bit at a time by saying (astral date: 2/3/2006 2:37 PM) :#
Hi folks!

I wrote an aspectLib.jar and want to wove the aspects to a whatever.jar
during loadtime. Everytime my application myApp.jar runs the whatever.jar is
being loaded into the VM and so the AspectLib should be woven during
loadtime.
I took the aj.bat script as an example and call something like this:
~~~~~~~~~~~~~~~~~snip
java -classpath $AspectJ_LIB/aspectjweaver.jar
-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader
-Daj.class.path=aspectLib.jar;whatever.jar -Daj.aspect.path=aspectLib.jar -jar myApp.jar
~~~~~~~~~~~~~~~~snap

No I get a ClassNotFoundException
org.aspectj.weaver.loadtime.WeavingURLClassLoader

(A simple: java -jar myApp.jar works fine.)

If I don't use the "-jar myApp.jar" option but call the Main class it also
works fine:
~~~~~~~~~~~~~~~~~snip
java -classpath $AspectJ_LIB/aspectjweaver.jar;myApp.jar
-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader
-Daj.class.path=aspectLib.jar;whatever.jar
-Daj.aspect.path=aspectLib.jar
foo.bar.MyAppMain
~~~~~~~~~~~~~~~~~snap

Why is that????

I'm using jre 1.5.0_05 but I don't want to use the -javaagent option.

Cheers,

CptNuss




Back to the top