Running the PhotoCard Sample from the Command Line

To run the PhotoCard sample:

  1. Open a Command Prompt window and perform the following:

    1. Navigate to the JC_HOME_SIMULATOR\bin directory.

    2. Start the simulator by using the following command at the command prompt:

      cref -o demoee

    Starting the simulator with the -o option and filename causes the simulator to save the EEPROM contents to a file named demoee.

  2. Open a second Command Prompt window and perform the following:

    1. Set ANT_HOME (path to ant install folder), JC_HOME_TOOLS and JC_HOME_SIMULATOR (path to JCDK install folder) as environment variables.

    2. Navigate to the JC_HOME_SIMULATOR\samples\classic_applets\PhotoCard\applet directory.

    3. Enter the following command at the command prompt:

      ant all

      In this sample's applet directory, the ant all command executes the APDU script, installs the photocard application, and creates an output file (default.out) in the applet directory.

  3. Verify that the contents of the output file in the applet directory are the same as the contents of the photocard-applet.expected.out file.

  4. In the cref Command Prompt window, restart the simulator by using the following command:

    cref -z -i demoee

    Starting the simulator with the -z and -i options and filename causes the simulator to use the contents of the demoee file to initialize the EEPROM and to display the resource consumption statistics.

  5. In the applet Command Prompt window, perform the following:

    1. Navigate to the JC_HOME_SIMULATOR\samples\classic_applets\PhotoCard\client directory.

    2. Enter the following command at the command prompt:

      ant all

      In this sample's client directory, the ant all command executes the APDU script and generates an output file (actual_output.txt) in the client directory.

  6. Verify that the contents of the actual_output.txt file are the same as the contents of the photocard-client.expected.out file.

    Note:

    Photo verification requires the MessageDigest class and SHA256 algorithm. If these are not available, the actual_output.txt file will not contain the last line of the photocard-client.expected.out file (Photo is valid).

    Depending on the locale that is used, the presentation of photo sizes might differ between actual_output.txt and photocard-client.expected.out. For example, "21,280 bytes" versus "21.280 bytes".