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] <mailto:[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
    <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
    aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org>
    https://dev.eclipse.org/mailman/listinfo/aspectj-users
    <https://dev.eclipse.org/mailman/listinfo/aspectj-users>

    Dean Wampler, Ph.D.
    dean at objectmentor.com <http://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
    aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org>
    https://dev.eclipse.org/mailman/listinfo/aspectj-users
    <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
aspectj-users@eclipse.org
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
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to