Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] question about using ajc with command line

When you say dep.jar is on the classpath, I presume that is for the
compilation and for the execution of the resultant out.jar? (since
those types will be needed at runtime).

Your command looks OK although I wouldn't normally specify -nosourceroots:
ajc -inpath source.jar -1.6 aspect.aj -outjar out.jar

Are you weaving an rt.jar??  If you are and are placing it in a
special location on the classpath (e.g. boot classpath), you would
also need to put dep.jar there so that the classloader can see both
the contents of the modified jar and the dependencies.  From what you
describe, it does sound a bit like a classloader visibility issue.

cheers,
Andy


On 12 December 2011 03:06, shaoxiaozhe09
<shaoxiaozhe09@xxxxxxxxxxxxxxxxxx> wrote:
> I want to weave a file aspect.aj to a executable java file like source.jar,
> and the output class files into the jar file out.jar.
>
> I use the command following:
> ajc -inpath source.jar -1.6 -sourceroots aspect.aj -outjar out.jar
>
> And the out.jar can be created without any error or warning. aspect.aj
> dependents on dep.jar. And dep.jar has been set in classpath. But when
> execute out.jar, NoClassDefFoundError exception will be reported about some
> class in dep.jar.
>
> Is the command right? What change should I do?
> 2011-12-12
> ________________________________
> shaoxiaozhe09
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top