Community
Participate
Working Groups
Whenever aspectjrt*.jar is not explicitly put onto the classpath by users of ajc, compilation fails with this error: [error] classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath) The batch scripts for UNIX and Windows both set ASPECTJ_HOME, if not present. So I think that ajc itself (not the batch files) could be made a bit smarter by searching for $ASPECTJ_HOME/lib/aspectjrt*.jar on the file system (I used the "*" because there might be a version number attached, who knows?) and adding it to the end of the classpath - either always or just in case it catches an error about unfound classes from org.aspectj.lang..*. Always would not hurt, I guess, even if ajc is just used as a replacement for java or ejc and no aspects are involved. But in order to avoid side effects it might make sense to be a bit more careful there. I tried adding something like this to my ajc.bat on Windows: if "%CLASSPATH%" == "" set CLASSPATH=%ASPECTJ_HOME%\lib\aspectjrt.jar This only works as long as the user does not specify any "-cp my_path" parameters by himself because as soon as he does, %CLASSPATH% is completely overridden. The user could use "-cp %CLASSPATH%;my_path" in that case, but that would need to be documented (at the moment all samples set CLASSPATH with aspectjrt.jar on it manually). Even though with some platform-dependent shell magic the classpath could be smartly manipulated to user-specified concatenate "-cp" and/or "-classpath" parameters and %CLASSPATH%, this would be complicated. I think that it makes more sense to do that in ajc's main class.