C H A P T E R  2

Installing the Ant Tasks


System Requirements

To use the current version of these tasks, you will need version 1.5.0_03 of the Java Runtime Environment and version 1.6.2 of Apache Ant installed on your system. You can obtain Apache Ant on documentation on Ant from the Apache web site at http://ant.apache.org.

The Ant tasks included in the Ant Tasks bundle have been tested on Solaristrademark 10 operating system and Windows XP (Pro), though they might work on other platforms as well.


Installing Apache Ant

The development kit requires Ant to run its tools and the demos. Once Ant is installed, the use of Ant in the development kit will not be apparent. If you have already installed Apache Ant version 1.6.2 for use in the development kit, you can skip this procedure.



Note - Ant is supported for use within the development kit, but its use as described in this book is not supported, nor have the Ant tasks been thoroughly tested.



1. Download and unzip Apache Ant in a separate directory.

If you don't already have Apache Ant version 1.6.2 installed on your system, you must download it from their web site at
http://ant.apache.org. Unzip the package in a directory that is separate from the development kit.

2. Add Ant to your system path.

Add Ant's bin directory to your system path.


Installing the Ant Tasks

1. Install Ant as described in Installing Apache Ant.

2. Unzip the Ant tasks bundle.

If you haven't already, unzip the Ant tasks bundle, which is included in the binary product and named java_card_kit-2_2_2-rr-ant-tasks.zip. When you unzip the Ant tasks bundle, the Ant tasks' Java Archive (JAR) file, jctasks.jar, is extracted into the subdirectory java_card_kit-2_2_2/ant-tasks/lib. This user's guide is extracted into the subdirectory java_card_kit-2_2_2/ant-tasks/docs in PDF and HTML format.

3. Copy the file jctasks.jar to a directory that will serve as your Ant tasks home directory.

This directory will be called JC_ANT_TASK_HOME throughout this book.

4. Add the file JC_ANT_TASK_HOME/lib/jctasks.jar to your classpath or put jctasks.jar into a directory named ANT_HOME/lib, from which it will automatically be picked up when Ant is run.


Setting Up the Ant Tasks

The following XML must be added your build.xml file to use the Ant tasks in your build.

<!-- Definitions for tasks for Java Card tools --> 
<taskdef name="apdutool"   
  classname="com.sun.javacard.ant.tasks.APDUToolTask" /> 
<taskdef name="capgen"   
  classname="com.sun.javacard.ant.tasks.CapgenTask" /> 
<taskdef name="maskgen"   
  classname="com.sun.javacard.ant.tasks.MaskgenTask" /> 
<taskdef name="deploycap"   
  classname="com.sun.javacard.ant.tasks.DeployCapTask" /> 
<taskdef name="exp2text"   
  classname="com.sun.javacard.ant.tasks.Exp2TextTask" /> 
<taskdef name="convert" 
  classname="com.sun.javacard.ant.tasks.ConverterTask" /> 
<taskdef name="verifyexport" 
  classname="com.sun.javacard.ant.tasks.VerifyExpTask" /> 
<taskdef name="verifycap" 
  classname="com.sun.javacard.ant.tasks.VerifyCapTask" /> 
<taskdef name="verifyrevision" 
  classname="com.sun.javacard.ant.tasks.VerifyRevTask" /> 
<taskdef name="scriptgen" 
  classname="com.sun.javacard.ant.tasks.ScriptgenTask" /> 
<typedef name="appletnameaid" 
  classname="com.sun.javacard.ant.types.AppletNameAID" /> 
<typedef name="jcainputfile" 
  classname="com.sun.javacard.ant.types.JCAInputFile" /> 
<typedef name="exportfiles" 
  classname="org.apache.tools.ant.types.FileSet" />


Library Dependencies

The libraries from the Java Card development kit in TABLE 2-1 are needed in your classpath if you are using the indicated feature. Alternatively, you can specify the classpath nested element for each task to put the required JAR files in the classpath during build execution.

TABLE 2-1 Library Dependencies

LIBRARIES

FEATURES

converter.jar and
offcardverifier.jar

Creating CAP, EXP or JCA files.

Using maskgen to create a mask.

Dumping contents of an EXP file in a text file.

offcardverifier.jar

Verifying EXP files, CAP files and verifying binary compatibility between two versions of an export file.

apdutool.jar and
apduio.jar

Sending an APDU script to cref.

capdump.jar

Dumping contents of a CAP file.

scriptgen.jar

Generating a APDU script from a CAP file.

apdutool.jar, apduio.jar
and scriptgen.jar

Installing a CAP file in cref and generate resulting EEPROM image.