Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Important aspects of JDK 1.4 weaving

Well, I've definitely figured something out!  It appears that putting "." in the classpath of your java execution call is a sole determinant of whether 1.4 load time weaving occurs.  I tried it with the aspect class files in the same directory as my HelloWorld App (my documented test) and in different directories, as one of the previous posters did -- in both cases, including or not-including "." in the classpath proved the determinant of success.  Of course, its important to know what exactly was IN the current directory, so an example is provided.
 
Here is my one-directory example, notice that of the two executions, the only one that fails (the second one) is the one with "." at the end of the classpath.  This result was totally reproducable when I moved my "HelloWorld.class" file to its own directory and adjusted my -Daj variables accordingly.  The value of any CLASSPATH environment variable appeared to have no effect one way or the other. 
 
Directory of C:\dev\libs\aspectj-1.5.1_a\test\aspects
04/26/2006  12:30 PM    <DIR>          .
04/26/2006  12:30 PM    <DIR>          ..
04/26/2006  11:57 AM             2,963 HelloAspect.class
04/24/2006  04:17 PM               229 HelloAspect.java
04/26/2006  11:56 AM               743 HelloWorld.class
04/24/2006  04:08 PM               214 HelloWorld.java
04/25/2006  12:26 PM    <DIR>      META-INF
               4 File(s)          4,149 bytes
               3 Dir(s)  55,905,079,296 bytes free
C:\dev\libs\aspectj-1.5.1_a\test\aspects>
 
C:\dev\libs\aspectj-1.5.1_a\test\aspects>"C:\j2sdk1.4.2_02\jre\bin\java" -classp
ath "c:\dev\libs\aspectj-1.5.1_a\lib\aspectjweaver.jar" "-Djava.system.class.loa
der=org.aspectj.weaver.loadtime.WeavingURLClassLoader" "-Daj.class.path=." "-Daj
.aspect.path=." HelloWorld
Before Hello World.
Hello World.

C:\dev\libs\aspectj-1.5.1_a\test\aspects>"C:\j2sdk1.4.2_02\jre\bin\java" -classp
ath "c:\dev\libs\aspectj-1.5.1_a\lib\aspectjweaver.jar;." "-Djava.system.class.l
oader=org.aspectj.weaver.loadtime.WeavingURLClassLoader" "-Daj.class.path=." "-D
aj.aspect.path=." HelloWorld
Hello World.
- Bo
(PS -- thanks for your reply Wes -- turns out I was unzipping the jar instead of running the install app; the only difference between the two appears to be whether you get the batch files, which must be a product of the install).  :)
 

Back to the top