Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] weaving an existing jar ?

If you want to weave into system classes I'd recommend a compile time
weave of either rt.jar (windows)/classes.jar (mac) -

ajc -inpath rt.jar MyAspect.aj -outjar newrt.jar

then put newrt.jar on the bootclasspath ahead of rt.jar

java -Xbootclasspath/p:newrt.jar MyApp

cheers,
Andy

On 2 October 2011 11:11, Yang <teddyyyy123@xxxxxxxxx> wrote:
> actually I found how to do it on maven aspectj plugin page.
>
>
> but now the further problem is, is it possible to weave a call from
> JRE itself (System.gc() ) ?
>
> the maven plugin only allows weaving jars and .class files
>
> Thanks
> Yang
>
> On Sun, Oct 2, 2011 at 12:15 AM, Yang <teddyyyy123@xxxxxxxxx> wrote:
>> I have a jar that contains a Blah class
>>
>> and in Blah() ctor it somehow calls System.gc()
>>
>>
>> now let's say I use the jar that contains Blah(), and call new Blah().
>> I would get the gc(),  so I am trying to detect this call ----- I'm
>> not sure where it called the "new Blah()" and System.gc()  .  I'm
>> trying to do through aspectj, by doing a pointcut on System.gc
>>
>>
>> but the problem is, now if I include the Blah() implementation in my
>> code, it's able to detect it, but if I just include the Blah() jar, it
>> can't weave and detect it.
>>
>> I tried adding the -javaagent:aspectjweaver.jar  (from the doc in
>> http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html#enabling-load-time-weaving)
>>  , but it doesn't work
>>
>>
>> I also included the source code .   the testweaver/yy dir contains the
>> files that create the jar that contains Blah class.
>>
>>
>> Thanks
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top