Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Invoking ajc from code

Plugins and classpaths can be tricky. First thing I would check is that 
aspectjrt.jar is both in the project's classpath (required for building), 
and ALSO in the plugin.xml file as a required library - otherwise you get 
the situation you describe where a plugin will build but not run.  It 
should look something like this:

   <library name="aspectjrt.jar">
         <export name="*"/>
    </library>

If you DO have aspectjrt.jar library in the plugin file, the other thing 
that sometimes causes trouble is the <export name="..."/> entries - make 
sure you're exporting the aspectj packages if you do use these.

-- Adrian
Adrian_Colyer@xxxxxxxxxx



Marc Hull <marc@xxxxxxxxxxxxxxxxxx> 
Sent by: aspectj-users-admin@xxxxxxxxxxx
07/09/2004 16:17
Please respond to
aspectj-users@xxxxxxxxxxx


To
aspectj-users@xxxxxxxxxxx
cc

Subject
[aspectj-users] Invoking ajc from code






Hello,
I'm writing an Eclipse plug-in that needs to compile some files using 
ajc. Currently, I do this using Runtime.exec(..) to execute the ajc 
executeable and pass it the files and other options as arguments, 
however I was wondering if there's a better way of doing this, by 
invoking the compiler directly from within my code?

I tried org.aspectj.tools.ajc.Main.main(..) and 
org.aspectj.ajdt.ajc.AjdtCommand.runCommand(..) but both generate the 
following error:

error can't find type org.aspectj.lang.JoinPoint

However, AspectJRT.jar is in my classpath - is this error appearing 
because I'm trying to invoke the compiler from within Eclipse?

Is there any way to get rid of this error, or can you think of a better 
way of achieving the same results?

Best wishes,
Marc Hull
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top