Contents Previous Next Index

Chapter   4

Running Applets in an Emulated Card Environment

The Java Card platform Workstation Development Environment (“Java Card Workstation Development Environment” or “Java Card WDE”) tool allows the simulated running of a Java Card applet as if it were masked in ROM. It emulates the card environment.

The Java Card WDE is not an implementation of the Java Card virtual machine. It uses the Java virtual machine to emulate the Java Card RE. Class files that represent masked packages must be available on the classpath for Java Card WDE.

For the 2.2.1 release of the Java Card reference implementation, Java Card WDE adds support for Java Card Remote Method Invocation (Java Card RMI).

Here are some of Java Card RE features that are not supported by Java Card WDE:

The Java Card WDE tool uses the jcwde.jar, api.jar (with cryptography extensions), and apduio.jar files. The main class for Java Card WDE is com.sun.javacard.jcwde.Main. A sample batch and shell script are provided to start Java Card WDE.

Preparing to Run the Java Card WDE Tool

Before you run the Java Card WDE tool, you must ensure that the environment variables are set appropriately and the applets to be configured are listed in a configuration file.

Setting Environment Variables

To set the environment variables correctly, refer to "Setting Environment Variables for the Solaris or Linux Platform" or "Setting Environment Variables for Microsoft Windows 2000 Platform".

Configuring the Applets in the Java Card WDE Mask

The applets to be configured in the mask during Java Card WDE simulation need to be listed in a configuration file that is passed to the Java Card WDE as a command line argument. Also, the CLASSPATH environment variable needs to be set to reflect the location of the class files for the applets to be simulated. In this release, the sample applets are listed in a configuration file called Each entry in this file contains the name of the applet class, and its associated AID.

The configuration file contains one line per installed applet. Each line is a white space(s) separated {CLASS_NAME AID} pair, where CLASS NAME is the fully qualified Java name of the class defining the applet, and AID is an Application Identifier for the applet class used to uniquely identify the applet. AID may be a string or hexadecimal representation in form:


where the construct 0xXX is repeated as many times as necessary.

Note that AID should be 5 to 16 bytes in length.

For example:

com.sun.javacard.samples.wallet.Wallet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x6:0x1 

Note – The installer applet must be listed first in the Java Card WDE configuration file.

If you write your own applets for public distribution, you should obtain an AID for each of your packages and applets according to the directions in Section 4.2 of the Virtual Machine Specification for the Java Card™ Platform, Version 2.2.1 (Sun Microsystems, Inc., 2003), and in the ISO 7816 Specification Parts 1-6.

Running the Java Card WDE Tool

The general format of the command to run the Java Card WDE and emulate the Java Card RE is:

jcwde [-help] [-p port] [-version] [-nobanner] <config-file> 


TABLE 7  –  Command Line Options for Java Card WDE
The configuration file described above.
Prints a help message.
Suppresses all banner messages.
Allows you to specify a TCP/IP port other than the default port.
Prints the Java Card WDE version number.

When started, Java Card WDE starts listening to APDUs in T=0 format on the TCP/IP port specified by the –p port parameter. The default port is 9025.


Contents Previous Next Index Development Kit User's Guide for the Binary Release with Cryptography Extensions
Java Card Platform, Version 2.2.1