Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4236500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:38:51+00:00 2026-05-21T02:38:51+00:00

I am having trouble understanding aspectJ’s compile-time and load-time weaving and figuring out what

  • 0

I am having trouble understanding aspectJ’s compile-time and load-time weaving and figuring out what to use(and how to use ajc) to compile and build my project.

Here’s my project structure:-

  • TestProject : a java service library.
    This is being used by a few other
    projects. This project do not contain
    any aspects.

  • TestProject-Aspects : Contains just
    aspects which advice a few classes in
    TestProject. I am not using the
    AspectJ5 annotation style and all my
    joinpoints are just at the method
    execution currently.

My questions:

  • ajc vs iajc and how are they
    different?
  • Is there any need for weaving?

  • Will something like this work ?

Compile TestProject-Aspects

<iajc>
    sourceroots=${sources.dir}
    destdir=${classes.dir}
    classpath=${standard.compile.classpath}
</iajc>

Compile TestProject

<iajc>
    sourceroots=${sources.dir}
    destdir=${classes.dir}
    classpath=${standard.compile.classpath}
    inpath=${[TestProject-Aspects]pkg.classpath}
</iajc>
  • Don’t I have to use javac at all ?
    which I was initially using to compile
    TestProject?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:38:52+00:00Added an answer on May 21, 2026 at 2:38 am

    ajc and iajc are extensions of the JDT compiler that comes with Eclipse. So, ajc and iajc will produce exactly the same byte code for pure Java as Eclipse would (which contains some minor differences to Oracle’s javac).

    ajc and iajc are basically the same except that iajc is incremental (that’s the i in iajc). This means that the compiler checks time stamps and does a smarter incremental build if possible and avoids full builds (just like when using AJDT inside of eclipse). Other than this functionality, they are essentially the same. See here for more information:

    http://www.eclipse.org/aspectj/doc/released/devguide/antTasks-iajc.html

    If a project contains no aspects, using the ajc compiler is optional. These projects can be on the inpath of a project that contains aspects. To compile that contain code-style aspects, then you need to use ajc.

    Annotation style aspects are a little different. If you are using annotation style for LTW only, then you can use javac to compile them as long as the correct aop.xml is created weaver is available at runtime.

    However, annotation style with CTW weaving does require ajc.

    In your particular case above, you can compile TestProject using javac as long as it is on the inpath of your aspect project. This would mean that the class files of your TestProject would be re-written and combined with the class files from your aspect project.

    Or, if you are using LTW, then you don’t need to add your TestProject to any inpath and you can use javac. But, you must set up your application for LTW at runtime.


    EDIT

    To answer your comment below:

    Yes. You can compile your aspects project first using ajc or the iajc task. Then, you can compile your second, pure java project also by using the iajc task and additionally by putting the results of your first project on the aspect path. You cannot use javac for this at all.

    The ant build.xml snippet will look something like this:

    <project name="simple-example" default="compile" >
      <taskdef 
          resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
        <classpath>
          <pathelement location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
        </classpath>
      </taskdef>
    
      <target name="compile" >
        <iajc sourceroots="${home.dir}/TestProject-Aspects/src" 
            classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"
            destDir="${home.dir}/TestProject-Aspects/bin"/> 
        <iajc sourceroots="${home.dir}/TestProject/src" 
            classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"
            destDir="${home.dir}/TestProject/bin"
            aspectPath="${home.dir}/TestProject-Aspects/bin"/> 
      </target>
    </project>
    

    See here for more details on iajc:

    http://www.eclipse.org/aspectj/doc/released/devguide/antTasks-iajc.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble understanding when to use properties in Objective C 2.0. It seems
I'm having some trouble figuring out how to take out what is not necessary
I'm having trouble understanding why a WSDL would be so beneficial, when the truth
I am having trouble understanding how the System Registry can help me convert a
In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem
I'm having a little bit of trouble understanding what the problem is here. I
I'm having trouble understanding why java secure coding is important. For example, why is
I'm having trouble understanding how compilers and linkers work and the files they create.
I'm having trouble understanding how QGraphicsItemAnimation's setScaleAt function works. Here's the code I'm using:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.