The other piece of the JCRE, the interpreter, is what physically resides on the smart card and
enables a normal smart card to support the Java Card platform. It performs the tasks of execu-
tion of bytecodes, allocating space for the created Java objects (remember that garbage collec-
tion is not supported) and ensuring runtime security.
Applet deployment would not be possible without another software module, the installer,
which resides with the interpreter on the card. It works together with an off-card installation
software, during a CAD session, for downloading and installing the CAP file.
We have seen some details of the Java Card platform. It is now time to make them concrete
with an example.
In order to run the code in this example, it is necessary to have installed the Java Card
Development Kit Version 2.1.2 or higher from Sun. The kit is available for downloads at
The JavaCard SDK can only be run on Windows NT 4.0 with Service Pack 4 or Solaris
on SPARC platforms. See the related “readme” file for more details.
Listing 5.5 shows an example of a Java Card applet. It is very simple, but it will serve our pur-
pose of illustrating the deployment of Java Card applets from the Java source code to the final
data transfer into the chip card.
For the scripts, we will use simple Windows scripting that could be adapted easily to any
Unix-like command-line environment.
To deploy our applet, follow these steps:
Write the Java source code, and compile it successfully.
Run the converter tool provided with the development kit, obtaining a CAP file.
Converting the CAP file in a sequence of low-level APDU commands to install the
applet onto the card.
Listing 5.5 shows our CardTest applet. It is only a demonstration applet; it does not perform
any useful task, neither does it use any standard APDU type in the processing. Nevertheless, it
will help us follow all the main steps from the source development to a basic, on-card applet