10 Set up the Eclipse Java Card Plug-in
The Java Card Development Kit Eclipse Plug-in assists you in developing Java Card applications. Most options available in the plug-in interface map directly to command-line options of the tools from the Java Card Development Kit Tools bundle (converter and verifier) and are described in the Java Card Development Kit Tools Users Guide. The plug-in runs the converter and verifier tools with the preferences you select.
This section includes procedures for performing the following tasks:
- Installing the Eclipse Plug-in
- Create a New Simulator Settings Profile
- Configuring the Java Card Tools Path
- Configuration Before Running the Samples
Installing the Eclipse Plug-in
Note:
The Eclipse Plug-in is not compatible with Simulator settings or configurations from previous versions. Before upgrading the plug-in, you must create a new Eclipse workspace, as settings or configurations from older versions will not work with the new plug-in. Retain your old workspace if you need to continue working with settings or projects from earlier plug-in versions.
The Java Card Development Kit Eclipse Plug-in is available for download at https://www.oracle.com/java/technologies/javacard-downloads.html#sdk-sim. To install the Plug-in:
- Download the Java Card Development Kit Eclipse Plug-in archive file to a directory of your choice. The available
.zipfile supports both Windows and Linux.java_card_devkit_eclipse_plugin-bin-v[version]-<buildID>-<dd-mmm-yyy>.zip
-
In the Eclipse menu bar, select Help, and then select Install New Software.
-
Click Add.
-
Click Archive.
-
Select the Eclipse Plug-in zip file.
-
In the Add Repository dialog, type
Java Card SDKin the Name field. -
Click Add.
-
On the Available Software dialog, select the feature to install:
Oracle Java Card Development Kit Eclipse Plug-in
-
Click Next until the terms of the licenses are displayed.
-
Please read and accept the terms of the licenses and click Finish to complete installation.
- When the Plug-in has been installed, Eclipse will prompt you to restart. Click Yes.
Note:
If you notice unusual behavior in Eclipse, such as an empty About window, update the
EclEmmaplug-in from version 3.1.8 to 3.1.9 using the Eclipse Marketplace.
Continue to Create a New Simulator Settings Profile.
Create a New Simulator Settings Profile
When creating a Java Card project in Eclipse, you specify the Java Card Development Kit Simulator you want to use, as multiple Simulators may be installed.
Note:
Plug-in configurations are stored within an Eclipse workspace. If you switch to another Eclipse workspace that is not configured, you will need to reconfigure the
Simulator SettingsandJava Card Tools Path. For additional information on reconfiguring, refer to the Set up the Eclipse Java Card Plug-in section.
- When you start Eclipse with the Plug-in installed, the Plug-in creates a Java Card Development Kit Simulator entry with the ID:
Java_Card_Simulator_1, which refers to the directory specified by the JC_HOME_SIMULATOR environment variable. The failure to create the simulator with the IDJava_Card_Simulator_1may be due to missing environment variables. If so, create the entry manually using the instructions below. Java_Card_Simulator_1is used for running the samples provided, but you can also use it for your own Java Card applications.
Simulator management settings can be accessed as follows:
- In Eclipse, from the Window menu, select Preferences.
- In the Preferences dialog, click on the arrow to the left of Java Card Simulators to expand the section.
- Now you can select Java Card Simulators to add, delete or update Simulator settings.
Edit a Simulator Settings Profile
To edit Java_Card_Simulator_1 follow these steps:
-
In Eclipse, from the Window menu, select Preferences.
-
In the Preferences dialog, click on Java Card Simulators and select Java_Card_Simulator_1.
-
Press the Edit… button.
-
In the edit window dialog, set Java Card Simulator Path to JC_HOME_SIMULATOR.
-
Upon first use, an error appears below the dialog title because no configuration file is specified. Enter a valid file in the GP ISD AND SCP03 Keys Config File field. A template is available at <absolute-path-to-jc-simulator>
/samples/client.config.properties. The samples also use this file (see How to Run the Samples); modify it to include:- A valid ISD entry (Note: No template line is present in this template file)
- A valid SCP03 key set injected into simulator binary (see Configuring the Java Card Development Kit Simulator)
The configuration file must at least contain the following entries:
ISD=<IssuerSecurityDomainAID> <IssuerSecurityDomainAID>_scp03enc_<KVN>=<k_enc> <IssuerSecurityDomainAID>_scp03mac_<KVN>=<k_mac> <IssuerSecurityDomainAID>_scp03dek_<KVN>=<k_dek>For example, the following entries match the information in the example provided in Configuring the Java Card Development Kit Simulator when the Java Card Development Kit Simulator is provisioned for the first time.
ISD=A000000151000000 A000000151000000_scp03enc_10=1111111111111111111111111111111111111111111111111111111111111111 A000000151000000_scp03mac_10=2222222222222222222222222222222222222222222222222222222222222222 A000000151000000_scp03dek_10=3333333333333333333333333333333333333333333333333333333333333333 -
Press the OK button.
Note:
If the Simulator Properties window displays a “Simulator Unique ID” error, close and reopen Simulator Properties after reloading the Java Card View. To reload the view, click Reload the view on the View toolbar, or right-click the top-level tree item and select Reload.
Configuring the Java Card Tools Path
To enable the Eclipse Plug-in to build a Java Card project, you must configure the Java Card Tools Path, which is the path where the tools bundle is extracted.
The tools bundle includes the converter and verifier tools. The Java Card Tools path is a workspace-wide setting that is used for all Java Card projects that are created in the same workspace. To configure the Java Card Tools path for the workspace, follow these steps:
- In Eclipse, from the Window menu, select Preferences.
- In the Preferences dialog, click the Java Card Tools Path section.
- In the Java Card Tools Path dialog, click Browse and select the directory where the Java Card Tools bundle is installed.
- Click Apply.
Note:
The
converterandverifiertools will be run using the Java executable referenced by the JAVA_HOME environment variable; if JAVA_HOME is not set, the JRE installed by Eclipse will be used instead.
Configuration Before Running the Samples
To run a sample Java Card application, you will:
- Import the projects
- Build the projects
- Start the Java Card Development Kit Simulator
- Run the sample-specific
clientJava application, which loads the applets(s), sends the necessary APDUs, and performs cleanup
Some instructions demonstrate different ways to complete a task to help you learn more about the Plug-in. Most options in the Plug-in dialogs correspond to command-line options for the Development Kit Tools (converter and verifier), as described in Building and Running the Samples from the Command Line. The Plug-in executes these tools with the options you select.
Here are a few notes on running the sample Java Card applications.
Java Card Development Kit Simulator Settings
When you start Eclipse, the Plug-in automatically creates or re-creates the Java Card Development Kit Simulator Entry: Java_Card_Simulator_1. If this entry is not created, refer to the instructions in Create a New Simulator Settings Profile.
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…, and 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. For the samples provided, this directory is the applet folder.
After you have imported a project, the build starts (if Build Automatically under the Project menu is selected) and generates the following artifacts for each Java Package within the deliverables subdirectory, which are created by the Converter Tool.
deliverables-cap,jca, andexpfilescapfile - Standard file format containing a binary representation of a shared library (library CAP file) or an application with its libraries that might be exported or not (applet CAP file). A CAP file represents a module, which is a unit of code, made of one or more Java packages, with dependencies and list of exported packages and an assigned name (AID) for lifecycle management. Its structure is made of multiple CAP components deployed within a JAR filejcafile - A JCA (Java Card platform Assembly) file is a textual representation of a converted package that you can use to aid testing and debug. You can use a JCA file as an input to thecapgentool to create a CAP fileexpfile - A Java Card technology-based export file (“Java Card export file”) contains the public interface information for an entire packages of classes. This means that an export file only contains information about the public API of a package and does not include information used to link classes within a package
After having built the Java Card applets(s), the corresponding client project must be imported and built. To do so, use the File menu, select Import > General > Projects from Folder or Archive to import the corresponding Java client project. Make sure that you select the directory that has Java source files for the client project. This directory is the client folder.
Running Java_Card_Simulator_1
Start the Simulator by right-clicking on Java_Card_Simulator_1 in Java Card View and selecting Start. The Simulator output is displayed in the Eclipse console.
Use the JCShell Terminal to connect to the Simulator and send APDUs. If the Launch jshell terminal on simulator start check box is selected in the Simulator settings, the terminal opens automatically when the Simulator starts. To open it manually, right-click Java_Card_Simulator_1 in Java Card View and select Start JShell. For information about the client methods and sample scripts, see Using JShell as a Simulator Client and Running Sample JShell Scripts.
Java_Card_Simulator_1 Settings
Change settings for the Simulator by double-clicking on Java_Card_Simulator_1 in the Java Card View to open the Properties dialog for Java_Card_Simulator_1. From this dialog, you can also change the debugger and other settings.
If you change these settings, ensure they match the expected sample Simulator settings before running the next sample. For the required Simulator settings, refer to the instructions in Editing a Simulator Settings Profile.
Classpath Variable Settings
All samples come with a pre-defined classpath file, including all of the 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 update a classpath variable in Eclipse, select Window > Preferences then expand Java > Build Path > Classpath variables and check for the JC_HOME_SIMULATOR variable. If it does not exist, create it and set its value to the root directory of the Java Card Development Kit Simulator bundle.
External JREs vs. Eclipse Internal JREs
We recommend installing either Oracle Java SE 25 or OpenJDK 25, as these versions have been tested. After installation, select Window > Preferences, expand Java > Installed JREs, click Add and select the installed JDK. Ensure that the corresponding check box for the selected JDK is checked to set it as the default JRE. Once a default JRE has been set, the line will change to bold with “(default)” added.
To verify the JRE that will be used, select Window > Preferences, expand Java > Installed JREs > Execution Environment, and check the external version of your choice.