Running the Samples in Eclipse
To run a sample, import the projects, build them, start the device, and then
run the sample-specific client
Java application which loads the applet(s),
sends necessary APDUs, and cleans up afterwards.
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
(converter
and verifier
) which are described in
Running the Samples from the Command Line. The plug-in runs those tools with the options that you select.
Here 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
>
General
>
Projects from Folder or Archive to import a Java Card
project. Make sure that you select the directory that contains the Java Card source
files. In most cases, this directory is the applet
folder.
-
deliverables
—cap
,jca
, andexp
files
The output files created by the converter (cap
,
jca
, and exp
files) are put in the the
deliverables
directory.
Running Sample_Device
After having built the Java Card applet(s) the according
client
project has to be imported. To do so, use the
File menu, select Import > General > Projects from Folder or
Archive to import the according Java client
project. Make
sure that you select the directory that has Java source files in it from the
project. In most cases, this directory is the client
folder.
Note:
Before starting up Sample_Device check its properties by right-clicking onto it, select Properties and make sure that the probably activated option Perform connect automatically on device start is unchecked. Otherwise, the sample's clients won't run and will not terminate correctly.Start the Simulator by right-clicking on Sample_Device in Java Card
View and selecting Start. The console opens with the output from the
Simulator and a prompt: ...CMD>
. Here you can enter an APDU
command which is sent to the card (Sample_Device
), the response
will be displayed on the console.
One simple way to test if the console is running is to type the
help
command at the prompt:
help
You should see a screen with all options available.
Sample_Device Settings
Change settings for the Simulator by double-clicking on
Sample_Device
in Java Card View to open the Properties for
Sample_Device
dialog. From the same dialog you can also change
the debugger and other settings.
If you do set these parameters, you may need to clear them before running the next sample.
Classpath Variable Settings
All samples come with a pre-defined classpath file including all necessary external libraries. These classpath files are part of the according Eclipse projects and use an internally defined classpath variable to automatically match the installation folder.
To create or modify a classpath variable select Window > Preferences. Expand Java > Build Path > Classpath variables and check for JC_HOME_SIMULATOR. If it does not already exist, create it and make sure to let it point to the root directory of the Simulator bundle installed on your machine.
External JREs vs. Eclipse internal JREs
We recommend that you install either Oracle Java SE 17 or OpenJDK Version 17, as these were the versions that were tested. After installation, select Window > Preferences. Expand Java > Installed JREs, click "Add" and, select the installed JDK. Make sure that you have checked the corresponding check box to ensure it acts as the default JRE.
To check this, select Window > Preferences. Expand Java > Installed JREs > Execution Environment and check an external version of your choice. The line will change to bold style and a comment “(default)”, also in bold style will be added.
Figure 10-1 Execution Environments
