Running the Samples in Eclipse

To run a sample, you import the project, build the project, start the device, run the CAP script to install the code, and then run the sample-specific script. Detailed instructions are provided for running each of the samples using Eclipse. Some instructions vary in how they do a task, so that you can learn about the plug-in as you follow along.

Almost all of the choices presented by the plug-in dialogs correspond to command-line options of the development kit tools (cref, converter, scriptgen and apdutool) which are described elsewhere in this guide. The plug-in runs those tools with the options that you select.

Following are a few notes on running the samples.

Sample_Platform and Sample_Device

When you start the Eclipse with the plug-in installed, it automatically creates or re-creates Sample_Platform and Sample_Device. If for some reason they are not created, refer to the instructions in Configuring Sample_Platform and Sample_Device.

Java Card View

The sample instructions refer to the Java Card view. If you don't see the Java Card view, go to the Window menu, select Reset Perspective... Click Yes to confirm the reset.

Importing and Building Projects

Using the File menu, select Import and General to import one or more projects at once, including both Java and Java Card projects. After you import a project, the build starts (if Build Automatically under the Project menu is selected) and generates the following artifacts for each Java package:
  • deliverables — cap, jca, and exp files

  • cap*.script — for installing the package

  • create*.script — for installing the applet

  • select*.script — for selecting the applet

The scripts are put in the apdu_scripts directory. The outputs from the converter (cap, jca, and exp files) are put in the the deliverables directory.

Running Sample_Device

Start cref by right-clicking on Sample_Device in Java Card View and selecting Start. The console opens with the output from cref and apdutool, and a prompt, CMD> You can enter an APDU command, which is sent to the card (Sample_Device), and the response is displayed on the console.

One simple way to test if the console is running is to type the echo command at the prompt:

echo "test";

You should see the APDU response:

test

To install a built package, right-click the corresponding cap*.script file and select Java Card and Execute Script.

Sample_Device Settings

Change settings for cref by double-clicking on Sample_Device in Java Card View to open the Properties for Sample_Device dialog. From the same dialog you can change the debugger and apdutool settings.

If you do set these parameters, you may need to clear them before running the next sample.

Run Configuration

Run Configuration can be used to automate how scripts are run. You can specify whether cref shall be started or re-started, and provide a list of scripts to be executed.