- Development Kit User Guide
- Setup, Samples and Tools
- Running the Samples
- Running the reference_apps Samples
- Transit Sample
- Running the Transit Sample in Eclipse
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.
- Import the
Transit_Applet
Java Card project andTransit_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.TheTransit_Applet
project build createsapdu_scripts
anddeliverables
directories. - In Java Card View, double-click Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
- 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 thebin
directory. Later, after the sample run, you can safely delete it. - Clear the Input file with EEPROM data, and the Output File for EEPROM data fields.
- Select Do not open APDU console.
- Click OK.
- 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
- 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. - 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. - 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). - Create run configurations:
run1
- Right-click the
Transit_Client
project, select Properties, select Run/Debug Settings, and click New. - In the Select Configuration Type window, select Java Application, click OK.
- Set the Name field to run1.
- Set the Main class to
com.sun.jcclassic.clients.transit.POSTerminal
- Select the Arguments tab
- Set the Program arguments to
-k FFFFFFFFFFFFFFFF -- VERIFY 12345 CREDIT 99 GET_BALANCE
- Click Apply and OK to close the window.
- Right-click the
- Create run configurations:
run2
- In the Select Configuration Type window, select Java Application, click OK.
- Set the Name field to run2.
- Set the Main class to
com.com.sun.jcclassic.clients.transit.TransitTerminal
- Select the Arguments tab
- Set the Program arguments to
-k FFFFFFFFFFFFFFFF -- PROCESS_ENTRY 999
- Click Apply and OK to close the window.
- Create run configurations:
run3
- In the Select Configuration Type window, select Java Application, click OK.
- Set the Name field to run3.
- Set the Main class to
com.sun.jcclassic.clients.transit.TransitTerminal
- Select the Arguments tab
- Set the Program arguments to
-k FFFFFFFFFFFFFFFF -- PROCESS_EXIT 10
- Click Apply and OK to close the window.
- Create run configurations:
run4
- In the Select Configuration Type window, select Java Application, click OK.
- Set the Name field to run4.
- Set the Main class to
com.sun.jcclassic.clients.transit.POSTerminal
- Select the Arguments tab
- Set the Program arguments to
-k FFFFFFFFFFFFFFFF -- VERIFY 12345 GET_BALANCE
- Click Apply and OK to close the window.
- In the Java Card View, double-click Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
- Select Do not open APDU console.
- Click OK.
- In Java Card View, right-click Sample_Device and select Start. The simulator starts and you can see the output in the Console view.
- In the Eclipse top menu, select Run and Run Configurations. Expand the
Java Application
entry if necessary, select run1, and then click Run. - 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 theTransitClient_1.expected.output
file for the following instructions:-
CLA:80 INS:30
-
CLA:80 INS:40
-
- In Java Card View, right-click Sample_Device and select Start. The simulator starts and you can see the output in the Console view.
- In the Eclipse top menu, select Run and Run Configurations. Select run2, and then click Run.
- 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 theTransitClient_2.expected.output
file for the following instructions:-
CLA:80 INS:30
-
CLA:80 INS:40
-
- In Java Card View, right-click Sample_Device and select Start.The simulator starts and you can see the output in the Console view.
- In the Eclipse top menu, select Run and Run Configurations. Select run3, and then click Run.
- 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 theTransitClient_3.expected.output
file for the following instructions:-
CLA:80 INS:30
-
CLA:80 INS:40
-
- In Java Card View, right-click Sample_Device and select Start.The simulator starts and you can see the output in the Console view.
- In the Eclipse top menu, select Run and Run Configurations. Select run4, and then click Run.
- 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 theTransitClient_4.expected.output
file for the following instructions:-
CLA:80 INS:30
-
CLA:80 INS:40
-