Ant is a build tool implemented in Java. It can be used to build Ptolemy II.
  1. Download Ant from
  2. Uncompress the file. We usually put vendor supplied tools in $PTII/vendors, but Ant can be installed anywhere
  3. Set the appropriate variables.

    Under bash:

    export ANT_HOME=$PTII/vendors/apache-ant-1.8.2
    export PATH=${PATH}:${ANT_HOME}/bin
    You may also need to set JAVA_HOME to the location of your Java installation.

    Under Linux: Use which java to find the directory that contains the Java Development Kit (JDK):

    -bash-3.2$ which java
    -bash-3.2$ ls -l /usr/bin/java
    lrwxrwxrwx 1 root root 26 Jul 31 10:12 /usr/bin/java -> /usr/java/default/bin/java
    -bash-3.2$ export JAVA_HOME=/usr/java/default

    Under Windows with Cygwin: If which java returns

    /cygdrive/c/Program Files/Java/jdk1.7.0/bin/java
    To temporarily set your path, use:
    export JAVA_HOME=c:/Program\ Files/Java/jdk1.7.0

    Permanently setting Windows Variables

    Under Windows, you can set these values permanently by doing Start -> right click on My Computer, select properties -> Advanced -> Environment Variables and then add the ANT_HOME and JAVA_HOME variables and update your path.
    Note you would need to use Windows DOS syntax when adjusting the path, add
    New user variable %PTII%/vendors/apache-ant-1.8.1
    New user variable c:/Program Files/Java/jdk1.7.0
    Edit the PATH in the user variables section and insert %ANT_HOME%/bin
    After setting the Windows variables, you will need to exit and restart your Cygwin bash shell.
  4. To test, type
    ant -h
    You should see a help message
  5. There are at two ways to configure Ptolemy: Use the simple build.default.xml or run configure. Most users will use build.default.xml

    Use build.default.xml

    The ptII/build.default.xml file is set up for a vanilla installation, it excludes third party packages like Java3D and Matlab.

    To use build.default.xml, merely copy it to build.xml

    cd $PTII
    cp build.default.xml build.xml

    Use configure

    The $PTII/configure script searches the local machine for third party packages and sets up Ant, Eclipse, and make appropriately. Under Windows, you must have Cygwin installed to run configure

    To use configure:

    cd $PTII
    See Ptolemy II Installation for details
  6. To build Ptolemy:
    cd $PTII
    This command will read $PTII/build.xml and build Ptolemy II.
  7. To see what other targets are available:
    ant -p
  8. To run Vergil:
    ant run
  9. To generate the actor documentation:
    ant javadoc

Ant notes

Open issues


ant test runs the JUnit tests located in the test/junit directories. Each directory contains that imports ptolemy/util/test/junit/ The file uses annotations to declare what tests should be run. For the auto tests that run models in test/auto/, we use JUnitParams from to parameterize the tests so that the model name appears in the JUnit log.
Tests need to be run in the test/ directory
Currently, the biggest limitation is that many of the tests need to be run in the test/ directory. To hack this in, we tell ant to use ptolemy/util/test/junit/javachdir as the jvm for the JUnit tests. The javachdir script reads in the ant-specific JUnit command line arguments, determines which directory should be used and cds to that directory.

The problem is that this does not work when we run the JUnit tests from Eclipse.

The solution is to fix the auto/* and *.tcl tests to be able to be run from any directory.