Skip to content

AIMA3e Using Ant

Ciaran O'Reilly edited this page Mar 15, 2015 · 1 revision

Using the Command Line and Ant

  • Ensure you have Ant installed on your system, see : http://ant.apache.org/

  • Ensure your environment is set up correctly to see the Ant and JDK installations on your machine. This can be done on Windows by setting up an appropriate .bat file, for example:

    set ANT_HOME=C:\Temp\AIMA\apache-ant-1.9.4
    set ANT_OPTS=-Xmx1024m
    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40\
    set PATH=C:\Temp\AIMA\apache-ant-1.9.2\bin;C:\Program Files\Java\jdk1.8.0_40\bin;%PATH%
    

    Note: you need to ensure your JDK and Ant bin directories are visible on your OS's path environment variable in order to be able to correctly run Ant from the command line.

  • Change directory into the the sub-project of interest, for example aima-core/ and then type ant at the command line. This will compile and run all of the project's unit tests by default.

  • To run a command line or GUI program do the following:
    Change into aima-gui/ and type:

    ant aima-gui.run
    ```<br>
    by default this will run aima.gui.applications.AimaDemoApp<br>
    If you wish to run an alternative program (for example the ProbabilityDemo) you can pass through the program to run to ant:<br>
    

    ant aima-gui.run -Daima-gui.run=aima.gui.demo.probability.ProbabilityDemo

    By default the aima-gui.run task will compile the code before running it. Therefore you can make changes 
    to the code and see differences in the output. For example if you changed the default number of samples to
    generate in the ProbabiltyDemo from:<br>
    

    ... public static final int NUM_SAMPLES = 1000;

    to:<br>
    

    ... public static final int NUM_SAMPLES = 100000;

    you should see more accurate results for the approximate inference algorithms (e.g. LikelihoodWeighting), though
    the program will take longer to run. The `aimax-osm/` project has also got a run task:<br>
    

    ant aimax-osm.run -Daimax-osm.run=...

  • For further details on how to use Ant see the project's online documentation: http://ant.apache.org/manual/index.html