Hi, Thanks for that, it makes things a little clearer.
But i am still facing a few problems. Here is what i did: 1. I created a Java project with one class which basically prints 'Hello World' 2. I packaged this into a jar and exported it to a location. 3. I created a AspectJ project with one aspect which prints a message after the call to the method which prints 'Hello World'. 4. I packaged this as a 'Jar File with AspectJ support' and exported it. 5. When i execute it with the command you have specified, all i can see is 'Hello World' with no message from the aspect. I thought there might be something wrong with my code, so i put the Hello World class in the aspect project. When i ran it, it displayed the right information. Am i doing something wrong? Do i need to do something more? Thanks again, Anirudh On 5/21/07, Sérgio Agostinho <[EMAIL PROTECTED]> wrote:
Hello there, You will need to do something like this: $ java -classpath ".:aspectjrt.jar:your_aspectj_project.jar" -jar your_java_project.jar This assumes that you are keeping the aspectJ runtime library and your aspects JARs in the same directory as to your application. It also assumes that your are creating a JAR file with your aspectJ project. Hope this helps, Anirudh Chandrakant wrote: Thank you so much for that information, dean! I still a little difficulty figuring out how this would work. Here is the scenario: I have a Java project. I do not have the sources, i only have the jar. I would like to weave aspects into this. I create an aspectJ project and define the aspects i want. I add the Java jar in the inpath of the aspectJ project. Now: 1. How do i execute the aspectJ project without a 'main' class? If i have to specify the 'main' class, what do i do in the main class? 2. How does it all work? If i execute the jar file, how are the aspects weaved in? How is the jar aware of the aspects? Maybe i am missing something extremely simple here, but i am unable to figure out how this whole setting would function. Thanks in advance, Anirudh On 5/21/07, Dean Wampler <[EMAIL PROTECTED]> wrote: > > Yes, use the "-inpath" option for ajc to specify the jars you want to "weave". Here's a good blog on the different path options. > > > http://www.aspectprogrammer.org/blogs/adrian/2004/10/three_paths_sta.html > > > dean > > > > > On May 21, 2007, at 6:05 AM, Anirudh Chandrakant wrote: > > > Hi, > > I am a new entrant into the aspectJ world and i am enjoying the ride so far. > I have used aspectJ with an existing project and it works as desired. > > Now, if i have a Java project but i do not have the source files (i only have the jar), can i still use aspectJ? (I know the signatures of all the methods that i want to insert my pointcuts into) > > The demo shows conversion of a normal project into an aspectJ project (in a step similar to instrumentation), i was wondering if this was possible with packaged classes. > > Thanks in advance, > Anirudh > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > Dean Wampler, Ph.D. > dean at objectmentor.com > http://www.objectmentor.com > http://www.aspectprogramming.com > http://www.contract4j.org > > > I want my tombstone to say: > Unknown Application Error in Dean Wampler.exe. > Application Terminated. > [Okay] [Cancel] > > > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > -- 'Tomorrow's what i am waiting for, but i can wait a little more' - Calvin (Bill Watterson) ________________________________ _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users -- Sérgio Agostinho Research Assistant CITI - Centre for Informatics and Information Technologies Faculdade de Ciências e Tecnologia Monte da Caparica 2829-516 Caparica Portugal E-mail: [EMAIL PROTECTED] URL: http://citi.di.fct.unl.pt Phone: +351 21 2948300 (ext. 10771) _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
-- 'Tomorrow's what i am waiting for, but i can wait a little more' - Calvin (Bill Watterson) _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
