Running the Service Sample in Eclipse

Run this sample using Run Configuration and the APDU console in Eclipse.

Start Eclipse. Sample_Platform and Sample_Device must already be created.
  1. Import the Service Java Card project into your workspace. If the build doesn't start automatically, start it manually.
    The 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. Clear the Input file with EEPROM data, the Output file for EEPROM data, and the Combined (input and output) file for EEPROM data fields.
    2. Clear Do not open APDU console.
    3. Click OK.
  3. Before you configure, run, and start any script, you must change the PowerDown parameters for generating the script files. Otherwise, the simulator goes into the PowerDown mode after running the cap-Service.script file and interrupts any execution of the following script files. To change the PowerDown parameters:
    1. In the Package Explorer view, click Service Java project .
    2. Right-click on the Java Card project and select Java Card and CAP Files Settings.
    3. Select a CAP file from the list that appears in the Java Card CAP Files page.
    4. Click Service and select Edit.
    5. In the Edit mode, select Compact CAP File.
    6. Click Next>.
    7. Select ScriptGen slide and select the Suppress "PowerDown;" APDU command at the end of CAP script check box.
    8. Click Finish and select Apply and Close.
  4. In the top menu, select Run and Run Configurations...
  5. In the Run Configurations dialog:
    1. Right-click on Java Card Project Run and select New.
    2. In the Name field, enter Service
    3. Click Browse..., select the Service project, and click OK.
    4. Select Start simulator.
    5. In the Scripts to be executed on simulator list box, add the following scripts:
      • Browse to the JC_HOME_SIMULATOR\samples\classic_applets\Service\applet\apdu-scripts directory and choose cap-com.sun.jcclassic.samples.service.script

      • From the same directory, select service.scr

    6. Click Run
    The simulator starts and executes the scripts in the list box, and you can see the output in the Console view.

    Compare the output with the contents of the service.expected.output file.