aboutsummaryrefslogtreecommitdiffstats
path: root/docs/devGuideDB/aj.xml
blob: 1604d540cbf9b0813d27d159980e03fa981c782f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<refentry id="aj-ref" xreflabel="The aj Command-line Reference">
	
  <refnamediv>	
    <refname>aj</refname>
    <refpurpose>command-line launcher for basic load-time weaving</refpurpose>
  </refnamediv>  

  <refsynopsisdiv>
    <cmdsynopsis>
       <command>aj</command>
      <arg><replaceable>Options</replaceable></arg>
      <group>
        <arg><replaceable>arg...</replaceable></arg>
      </group>
    </cmdsynopsis>
  </refsynopsisdiv>
    <refsect1 id="aj" xreflabel="aj">
        <title>Description</title>
        
        <para>The
            <command>aj</command> command runs Java programs in Java 1.4 or
            later by setting up
            <literal>WeavingURLClassLoader</literal> as the system class
            loader, to do load-time bytecode weaving. </para>
        
        <para> The arguments are the same as those used to launch the Java program.
            Users should define the environment variables
            <literal>CLASSPATH</literal> and
            <literal>ASPECTPATH</literal>. </para>
        
        <para>For more information and alternatives for load-time weaving,
        see <xref linkend="ltw"/>.
        </para>
        
        <refsect2>
            <title>Examples</title>
            
            <example id="simpleajexample">
                <title>A simple example</title>
                
                <para>Use ajc to build a library, then weave at load time</para>
                
                <programlisting><![CDATA[                     
    REM compile library
    ${ASPECTJ_HOME}\bin\ajc.bat -outjar lib\aspects.jar @aspects.lst
                
    REM run, weaving into application at load-time set
    ASPECTPATH=lib\aspects.jar set CLASSPATH=app\app.jar
    ${ASPECTJ_HOME}\bin\aj.bat com.company.app.Main "Hello, World!" 
]]>                </programlisting>
                
            </example>
        </refsect2>
    </refsect1>
</refentry>