## Packaging

You do not always have to use the system property jboss.aop.path to specify JBossAOP XML files. By default, JBossAOP will also look in your classpath for any URL that matches META-INF/jboss-aop.xml.

The example in this directly is take from the method-execution example. Instead of using declaring jboss.aop.path as a system property, this example instead packages up all the .class files in a jar along with META-INF/jboss-aop.xml in the resources directory.

    C:\jboss\jboss-head\aop\tmp\docs\examples\packaging>jar -tf example.jar
    META-INF/
    META-INF/MANIFEST.MF
    Driver.class
    MethodInterceptor.class
    POJO$Bar.class
    POJO.class
    SimpleInterceptor.class
    META-INF/jboss-aop.xml

You can turn off this classpath behavior by using the jboss.aop.search.classpath=false system property. By default it is on. (FYI, it is off by default when running in the JBoss Application Server).

#### Run the example

To compile and run:

      $ ant

It will javac the files and then run the AOPC precompiler to manipulate the bytecode, then finally run the example. The output should read as follows:

    run:
         [java] --- pojo.noop(); ---
         [java] <<< Entering SimpleInterceptor
         [java] noop()
         [java] >>> Leaving SimpleInterceptor
         [java] --- pojo.test1(String param); ---
         [java] test1(String param): hello world
         [java] --- pojo.test1(int param); ---
         [java] <<< Entering MethodInterceptor for: public void POJO.test2(int)
         [java] test2(int param): 55
         [java] <<< Entering MethodInterceptor for: public void POJO$Bar.hello()
         [java] hello
         [java] >>> Leaving MethodInterceptor
         [java] >>> Leaving MethodInterceptor
         [java] --- POJO.test2(); ---
         [java] <<< Entering MethodInterceptor for: public static void POJO.test2()
         [java] static method
         [java] >>> Leaving MethodInterceptor