Ant Build Instructions

These instructions are useful for the ant-directed builds required by the course software. While eclipse knows many things about how to compile Java, compiler modules are generated using tools, and eclipse does not know natively how to run those tools nor how to deal with the software generated by such tools.

The bottom line is that everything is easy using ant, but a few steps are necessary to configure your workspace properly to run ant and its tasks in the proper way.

Always begin by installing your studio or lab software as directed. When you are referred to this document, follow the steps below.


  1. The code used in this project may reference portions of the cup runtime library. If you see the java-cup-11a jar file listed under Referenced Libraries in the eclipse package explorer, then you can skip this step and move on to the next. Otherwise, do the following:

    Look for the java-cup-11a jar file in the Tools folder in the eclipse package explorer. If it is missing, then the jar file is not needed for this work, so you can move on to the next step. Otherwise, do the following:

  2. Locate the build.xml file at the outermost level of your studio or lab project.
  3. If you are referred to this document, then it is time to try to run the build.xml file using ant.

    Right- (control-) click on the build.xml file, and select Run as →

  4. Although it is tempting to do so, do not select Ant Build, the first and most obvious choice, as a small change must be made before the build will work.
    Instead, choose Ant Build . . ., the one with the ellipses, which leads to a configuration panel.
  5. Select the JRE tab
  6. Click the selection that specifies Run in the same JRE as the workspace.
  7. Now click Run and your build should work.
  8. You can repeat your last run by clicking the button depicted as a smaller green circle with a white triangle and red toolbox, located in the button toolbar near the top of the eclipse window.

    This button is to the right of a similar-looking button. The button to the left will re-run an application, while the button to the right will re-run the ant build task.

    Using this button can save you a lot of time! As you work on your project and need to run the code, just click on that button and the ant build should run again.

    The build files are written to avoid unnecessary work, so it is always best and fastest to click the button and run the default ant task.