Running the Transit Sample from the Command Line

The TransitDemo or TransitDemo.bat script automatically starts and stops cref when needed to simulate interaction sessions with the POS terminal and the turnstile transit terminal.

  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 transitCard
  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\reference_apps\Transit\Transit\applet directory.
    3. Enter the following command at the command prompt:
      ant all

      In this sample's applet directory, the ant all command generates the APDU script and downloads the CAP file.

  3. In the cref Command Prompt window, restart the simulator by using the following command:
    cref -i transitCard -o transitCard

    Starting the simulator with the -i transitCard -o transitCard options and filenames causes the simulator to use the contents of the transitCard file to initialize the EEPROM and to save the EEPROM contents to a file named transitCard.

  4. In the applet Command Prompt window, perform the following:
    1. Navigate to the JC_HOME_SIMULATOR\samples\reference_apps\Transit\Transit\client directory.
    2. Enter the following command at the command prompt:
      ant run1

      In this sample's client directory, the ant run1 command compiles and builds the client.jar and generates the actual_output1.txt file.

  5. Verify that the contents of the actual_output1.txt file are the same as the contents of the TransitClient_1.expected.output file.
    Because the terminal uses random number generation for challenge/response and for generating session key, the contents of the actual_output1.txt file varies from the TransitClient_1.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  6. In the cref Command Prompt window, restart the simulator by using the following command:
    cref -i transitCard -o transitCard
  7. In the applet Command Prompt window, enter the following command at the command prompt:
    ant run2

    In this sample's client directory, the ant run2 command compiles and builds the client.jar and generates the actual_output2.txt file.

  8. Verify that the contents of the actual_output2.txt file are the same as the contents of the TransitClient_2.expected.output file.
    Because the terminal uses random number generation for challenge/response and for generating session key, the contents of the actual_output2.txt file varies from the TransitClient_2.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  9. In the cref Command Prompt window, restart the simulator by using the following command:
    cref -i transitCard -o transitCard
  10. In the applet Command Prompt window, enter the following command at the command prompt:
    ant run3

    In this sample's client directory, the ant run3 command compiles and builds the client.jar and generates the actual_output3.txt file.

  11. Verify that the contents of the actual_output3.txt file are the same as the contents of the TransitClient_3.expected.output file.
    Because the terminal uses random number generation for challenge/response and for generating session key, the contents of the actual_output3.txt file varies from the TransitClient_3.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  12. In the cref Command Prompt window, restart the simulator by using the following command:
    cref -i transitCard -o transitCard
  13. In the applet Command Prompt window, enter the following command at the command prompt:
    ant run4

    In this sample's client directory, the ant run4 command compiles and builds the client.jar and generates the actual_output4.txt file

  14. Verify that the contents of the actual_output4.txt file are the same as the contents of the TransitClient_4.expected.output file.
    Because the terminal uses random number generation for challenge/response and for generating session key, the contents of the actual_output4.txt file varies from the TransitClient_4.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40