Running the Samples from the Command Line

To build and run the samples:

  1. In a Command Prompt window, start the Java Card simulator by using the cref command with the options specified by the sample.

    See Using the Reference Implementation for more information about using cref and its command line options.

  2. In a second Command Prompt window, from the sample directory containing the appropriate build.xml file, run the ant command with the appropriate target:

    ant target

    In the command, target represents the run option (such as all or run1-1) specified in the procedures for running the sample. Each sample might use one or more targets to run specific APDU scripts or multiple parts of the sample applet. The required targets are described in the procedures used to run an individual sample.

    With the exception of the Transit, RMIPurse, and SecureRMIPurse samples, a custom name can be specified for the output file generated by the ant command. Use the following command syntax to specify a custom name for the output file:

    ant -Dredirect.output=outputfile_name target

    In this command, outputfile_name represents the name of the output file. This command redirects the output from the APDUtool execution to the outputfile_name file.

  3. Perform any additional actions required by the individual sample's run procedure.

    Additional actions might include restarting the RI and using ant with an appropriate target to run additional APDU scripts generated by the build. These actions are described in the procedures used to run each sample.