Developing Web Applications With Ant by Richard Hightower - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

The HelloWorldApplet that communicates with HelloWorldServlet.
Creating a Build File for the Applet

The applet project build file is quite simple, as shown in Listing 20.21. It is structured much like the application project build file.

 

<project name="applet" default="all" >
<property name="outdir" value="/tmp/app" />
<target name="init" description="initialize the properties.">

<property name="local_outdir" value="${outdir}/applet" /> <property name="build" value="${local_outdir}/classes" /> <property name="lib" value="${outdir}/lib" /> <property name="jar" value="${lib}/helloapplet.jar" />

</target>
<target name="clean" depends="init"
description="clean up the output directories.">
<delete dir="${build}" />
<delete dir="${jar}" />
</target>

<target name="prepare" depends="init"
description="prepare the output directory."> <mkdir dir="${build}" />
<mkdir dir="${lib}" />

</target>
<target name="compile" depends="prepare"
description="compile the Java source."> <javac srcdir="./src" destdir="${build}" />
</target>
<target name="package" depends="compile"
description="package the Java classes into a jar."> <jar jarfile="${jar} " basedir="${build}" /> </target>
<target name="all" depends="clean,package"
description="perform all targets."/> </project>

 

Listing 20.21