Running the Transit Sample in Eclipse

The Transit sample consists of two projects: a Java Card project with the Java Card applet and a Java SE project with the Java application that is designed to communicate with the applet.

Start Eclipse. Sample_Platform and Sample_Device must already be created.
  1. Import the Transit_Applet Java Card project and Transit_Client Java project into your workspace.
    You can import both projects in the same Import wizard. If the builds don't start automatically, start them manually.
    The Transit_Applet project build creates apdu_scripts and deliverables directories.
  2. In Java Card View, double-click Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
    1. In the Combined (input and output) file for EEPROM data field, type a file name to be used for saving EEPROM between simulator sessions, such as TransitCard.eeprom. The file will be automatically created in the bin directory. Later, after the sample run, you can safely delete it.
    2. Clear the Input file with EEPROM data, and the Output File for EEPROM data fields.
    3. Select Do not open APDU console.
    4. Click OK.
  3. In Java Card View, right-click Sample_Device and select Start.
    The simulator starts and you can see that the Sample_Device console is created.
  4. In the Sample_Device console toolbar, click the Select Script drop-down button and select cap-com.sun.jcclassic.samples.transit.
    Wait until the script execution completes and CMD> prompt is displayed.
  5. Click the Select Script drop-down button again and select the TransitDemoFooter_notransitkey script.
    The script executes and the simulator stops. Verify that the last script finished successfully (the last APDU command got response with SW1: 90, SW2: 00).
  6. Create run configurations: run1
    1. Right-click the Transit_Client project, select Properties, select Run/Debug Settings, and click New.
    2. In the Select Configuration Type window, select Java Application, click OK.
    3. Set the Name field to run1.
    4. Set the Main class to com.sun.jcclassic.clients.transit.POSTerminal
    5. Select the Arguments tab
    6. Set the Program arguments to
      -k FFFFFFFFFFFFFFFF -- VERIFY 12345 CREDIT 99 GET_BALANCE
    7. Click Apply and OK to close the window.
  7. Create run configurations: run2
    1. In the Select Configuration Type window, select Java Application, click OK.
    2. Set the Name field to run2.
    3. Set the Main class to com.com.sun.jcclassic.clients.transit.TransitTerminal
    4. Select the Arguments tab
    5. Set the Program arguments to
      -k FFFFFFFFFFFFFFFF -- PROCESS_ENTRY 999
    6. Click Apply and OK to close the window.
  8. Create run configurations: run3
    1. In the Select Configuration Type window, select Java Application, click OK.
    2. Set the Name field to run3.
    3. Set the Main class to com.sun.jcclassic.clients.transit.TransitTerminal
    4. Select the Arguments tab
    5. Set the Program arguments to
      -k FFFFFFFFFFFFFFFF -- PROCESS_EXIT 10
    6. Click Apply and OK to close the window.
  9. Create run configurations: run4
    1. In the Select Configuration Type window, select Java Application, click OK.
    2. Set the Name field to run4.
    3. Set the Main class to com.sun.jcclassic.clients.transit.POSTerminal
    4. Select the Arguments tab
    5. Set the Program arguments to
      -k FFFFFFFFFFFFFFFF -- VERIFY 12345 GET_BALANCE
    6. Click Apply and OK to close the window.
  10. In the Java Card View, double-click Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
    1. Select Do not open APDU console.
    2. Click OK.
  11. In Java Card View, right-click Sample_Device and select Start.
    The simulator starts and you can see the output in the Console view.
  12. In the Eclipse top menu, select Run and Run Configurations. Expand the Java Application entry if necessary, select run1, and then click Run.
  13. Verify that the contents of the console 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 console varies from the TransitClient_1.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  14. In Java Card View, right-click Sample_Device and select Start.
    The simulator starts and you can see the output in the Console view.
  15. In the Eclipse top menu, select Run and Run Configurations. Select run2, and then click Run.
  16. Verify that the contents of the console 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 console varies from the TransitClient_2.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  17. In Java Card View, right-click Sample_Device and select Start.
    The simulator starts and you can see the output in the Console view.
  18. In the Eclipse top menu, select Run and Run Configurations. Select run3, and then click Run.
  19. Verify that the contents of the console 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 console varies from the TransitClient_3.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40

  20. In Java Card View, right-click Sample_Device and select Start.
    The simulator starts and you can see the output in the Console view.
  21. In the Eclipse top menu, select Run and Run Configurations. Select run4, and then click Run.
  22. Verify that the contents of the console 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 console varies from the TransitClient_4.expected.output file for the following instructions:
    • CLA:80 INS:30

    • CLA:80 INS:40