Java Card 3 Platform Development Kit User Guide, Classic Edition
Running the PhotoCard Sample in Eclipse
The PhotoCard 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
PhotoCard_Applet
Java Card project and the PhotoCard_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 PhotoCard_Applet
project build creates apdu_scripts
and deliverables
directories.
- In Java Card View, double-click on 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, e.g.,
PhotoCard.eeprom
. The file will be automatically created in the bin directory. Later, after the sample run, you can safely delete it.
- Clear the Input file with EEPROM data and the Combined (input and output) file for EEPROM data fields.
- Clear Do not open APDU console.
- Click OK.
- In Java Card View, right-click on Sample_Device and select Start.
The simulator starts and you can see that Sample_Device console is created.
- In Sample_Device console toolbar, click the Select Script drop-down button and select
cap-com.sun.jcclassic.samples.photocard
. Wait until the script execution completes and the CMD> prompt is displayed
- Click the Select Script drop-down button again and select
create-com.sun.jcclassic.samples.photocard.PhotoCardApplet
. Verify that the script finished successfully, i.e., with SW1: 90, SW2: 00
- In Sample_Device console toolbar, click the Stop the device button.
The simulator stops, and EEPROM data is saved in PhotoCard.eeprom
file.
- In Java Card View, double-click on Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
- In the Input file with EEPROM data field, click Browse.. and select the
PhotoCard.eeprom
file.
- Clear the Output file with EEPROM data.
- Select Do not open APDU console.
- Click OK.
- In Java Card View, right-click on Sample_Device and select Start.
The simulator starts and you can see the output in the Console view.
- In the Package Explorer view, right-click on PhotoCard_Client and select Run As and Run Configurations...
- In the Run Configurations dialog:
- Right-click on Java Application and select New.
- Select the Arguments tab.
- Enter the following program arguments: duke_magnify.gif duke_pencil.gif duke_wave.gif duke_thumbsup.gif and click Run
When the program completes you can compare its output with the photocard-client.expected.out
file.
Table of Contents
Java Card: 3 Platform Development Kit User Guide, Classic Edition
Expand |
Collapse