Example of build file for Ant
    Copyright 2003-2012 DeNova
    All rights reserved worldwide.
    The following build assumes that you have a JExpress project already created which builds your installers. 
    Search this file for the word WARNING and adapt each of the values to your system. 
    If your installer include custom classes and you use a JExpress subproject to find all the
    custom classes for the installer, then adapt the build-custom.xml file.

<project name="Installer" default="build" basedir=".">

        Installer build file

    <property environment="env"/>

    <!-- release information -->
    <property name="version" value="1.0"/>
    <!-- directories -->
    <!-- WARNING: Adapt to your local system -->
    <!-- installation directory for JExpress -->
    <property name="jexpress.installed.dir" value="/usr/local/bin/JExpress"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- program name for your Java compiler -->
    <property name="compiler.name" value="javac"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- Directory where your project resides -->
    <property name="projects.dir" value="${jexpress.installed.dir}/projects"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- Installer project created by JExpress. This should be the -->
    <!-- the directory name, not the .jex file. -->
    <property name="project.name" value="Hello World"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- Application name it must match name entered on the Welcome panel,
         but be in all lower case with dashes in place of spaces -->
    <property name="app.name" value="hello-world"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- distribution directory for your app's installer -->
    <property name="dist.dir" value="${user.dir}/distribution/hello"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- JVM version to compile source files -->
    <property name="jvm.version" value="1.5"/>
    <!-- WARNING: Adapt to your local system -->
    <!-- directory to store custom classes; if you're running on
         Windows Vista/7, you probably need to change this to a subdirectory
         of your Users directory -->
    <property name="custom.installer.destdir" value="${jexpress.installed.dir}/CustomInstaller"/>
    <!-- targets -->

    <!-- builds all custom class files and the installer -->
    <target name="build" 
        description="Build Installer"/>
    <!-- cleans class files, compiles, and builds a new installer -->
    <target name="cleanbuild" 
        description="Remove buildable files and then build"/>
    <!-- runs an already created installer -->
    <target name="run"
        description="Run the Pure Java installer">
        <exec dir="${dist.dir}/installers" executable="java">

            <arg value="-jar"/>
            <arg path="${app.name}-cross-platform-${version}.jar"/>

    <!-- compiles the Samples classes -->
    <!-- You probably want to limit the java files to the ones 
         you want included in your installer -->
    <!-- You should set the Location of classes on the Custom | Installer panel
         to match the custom.installer.destdir -->
    <!-- You should add this class as a dependency to the installer.build if your
         installer needs to use any of the sample custom classes. -->
    <target name="compile.sample">
            <include name="**/*.java"/>
    <!-- the following targets are unlikely to be invoked from the command line -->
    <target name="init">
        <property name="build.compiler" value="${compiler.name}"/>

        <antcall target="jexpress.required" />
    <target name="jexpress.required">
        <condition property="is.jexpress.installed">
        <fail unless="is.jexpress.installed"
            message="Change the jexpress.installed.dir property to match your installation directory for JExpress."/>
    <target name="installer.build"
        <!-- build the installer -->
    <target name="clean" 
        description="Remove buildable files"/>
    <target name="installer.clean" 
        description="Remove installer's class files">
        <delete quiet="true">
            <fileset dir="${src.dir}">
                <include name="**/*.class"/>
    <target name="dist.clean"
        description="Remove distribution files">
        <!-- delete this entire subdirectory tree -->
        <delete quiet="true" dir="${dist.dir}"/>
    <macrodef name="jexpress.build">
        <attribute name="jexpress.installed.dir"/>
        <attribute name="project"/>
        <attribute name="buildir"/>
        <attribute name="version"/>
        <delete failonerror="false" quiet="true" file="@{jexpress.installed.dir}/errors.log"/>
        <delete failonerror="false" quiet="true" file="@{jexpress.installed.dir}/warnings.log"/>
        <echo message="Building: @{project}"/>

            <arg value="-classpath"/>
            <arg path="@{jexpress.installed.dir}"/>

            <arg value="com.denova.JExpress.Builder.JExpressAdvanced"/>
            <arg value="@{project}"/>
            <arg value="-buildir"/>
            <arg value="@{buildir}"/>
            <arg value="-version"/>
            <arg value="@{version}"/>
        <condition property="build.failed">
                <equals arg1="${build.result}" arg2="-1"/>
                <equals arg1="${build.result}" arg2="255"/>
        <fail message="Build failed. See @{jexpress.installed.dir}/errors.log">
            <condition><isset property="build.failed"/></condition>
    <!-- This target is intentionally empty.
         Simply running another target, even empty, cancels the current one. --> 
    <target name="cancel" 
        description="Cancel current Ant process"/>