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.
  1. 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.
  2. In Java Card View, double-click on 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, e.g., PhotoCard.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 Combined (input and output) file for EEPROM data fields.
    3. Clear Do not open APDU console.
    4. Click OK.
  3. 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.
  4. 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
  5. 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
  6. In Sample_Device console toolbar, click the Stop the device button.
    The simulator stops, and EEPROM data is saved in PhotoCard.eeprom file.
  7. In Java Card View, double-click on Sample_Device. In the Properties for Sample_Device dialog, select the CREF tab:
    1.  In the Input file with EEPROM data field, click Browse.. and select thePhotoCard.eeprom file.
    2. Clear the Output file with EEPROM data.
    3. Select Do not open APDU console.
    4. Click OK.
  8. 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.
  9. In the Package Explorer view, right-click on PhotoCard_Client and select  Run As and Run Configurations...
  10. In the Run Configurations dialog:
    1. Right-click on Java Application and select New.
    2. Select the Arguments tab.
    3. 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.