Bug 119383 - Classpath problem with AspectJ Compiler 1.5.0M5
Summary: Classpath problem with AspectJ Compiler 1.5.0M5
Status: RESOLVED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M5   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-06 04:37 EST by Dhana CLA
Modified: 2006-05-03 04:33 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 Dhana CLA 2005-12-06 04:37:18 EST
Hi,

I am trying to compile few dynamically generated aspects programatically. In the program i will contruct a classpath with aspectjrt.jar and aspecttools.jar and other third party jars, which my program depends on. And i compile the dynamically generated aspects as follows,

java -Xmx512m -classpath (followed by all the jars that i have constructed) org.aspectj.tools.ajc.Main E:\MyProject\com\test\aspect\myaspect\hdyb\*.java

When executed as above, it gives the following error,

Exception thrown from AspectJ 1.5.0M5

This might be logged as a bug already -- find current bugs at
  http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.

when batch building with classpath:
<classpath>
In the classpath built by aspectj, aspectjtools.jar is not present.

When i try to run the same scenario from command prompt, by explicitly setting in the classpath aspectjtools.jar and aspectjrt.jar and other third party jars, which my stub depends on.. it is compiling successfully and also weaving successfully.

Please let me know, how aspectjtools.jar is considered by ajc in the classpath.

Thanks in advance
R.S.Dhanalakshmi
Comment 1 Andrew Clement CLA 2005-12-06 04:43:04 EST
> I am trying to compile few dynamically generated aspects programatically. In
> the program i will contruct a classpath with aspectjrt.jar and aspecttools.jar
> and other third party jars, which my program depends on. And i compile the
> dynamically generated aspects as follows,

I presume aspecttools.jar is a typo though? and it should read aspectjtools.jar.

Take a look in the batch file for ajc, c:\aspectj1.5\bin\ajc.bat to see how ajc puts aspectjtools.jar on the classpath for invoking the compiler.

----8<-----
@echo off
REM This file generated by AspectJ installer

if "%JAVA_HOME%" == "" set JAVA_HOME=C:\Program Files\Java\j2re1.4.2_01
if "%ASPECTJ_HOME%" == "" set ASPECTJ_HOME=c:\aspectj1.5.0-dev

if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
if exist "%JAVA_HOME%\bin\java" goto haveJava
echo java does not exist as %JAVA_HOME%\bin\java
echo please fix the JAVA_HOME environment variable
:haveJava
"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar;%JAVA_HOM
E%\lib\tools.jar;%CLASSPATH%" -Xmx64M org.aspectj.tools.ajc.Main %*
----8<-----
Comment 2 Adrian Colyer CLA 2006-05-03 04:33:05 EDT
This was never a bug, more of a question! I'm presuming that Andy's last comment (as of December 2005) solved the problem, if not, please post to the users or dev list.

Thanks.