11 Running the Samples in Eclipse
Before running the samples, please ensure you have read the Configuration Before Running the Samples section. The following sections describe the Java Card Development Kit samples in order of increasing complexity and provide procedures for running them:
-
Running the HelloWorld Sample in Eclipse - A minimal applet utilizing the simplest source code and meta-files that demonstrates the base structure of a Java Card applet that developers can use to develop, deploy, create, execute, delete, and unload a standalone module.
-
Running the Channels Sample in Eclipse - Demonstrates the use of logical channels, which allows selecting multiple applets at the same time.
-
Running the Utility Sample in Eclipse - Demonstrates the use of the utility APIs in an applet to simulate stock trading and portfolio management.
-
Running the Wallet Sample in Eclipse - Demonstrates a simplified cash card application.
-
Running the ObjectDeletion Sample in Eclipse - Demonstrates applet and package deletion and the object deletion mechanism that removes unreachable objects.
-
Running the SignatureMessageRecovery Sample in Eclipse - Demonstrates message recovery. This sample is only included in bundles with cryptography extensions.
-
Running the ArrayViews Sample in Eclipse - Demonstrates a client/server application sharing data using array views.
Running the HelloWorld Sample in Eclipse
Run the HelloWorld sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
appletdirectory from theHelloWorldproject, to import theHelloWorldJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build places the Converter output files (
.cap,.jca, and.exp) in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theHelloWorldproject, to import theHelloWorldJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card View, right-click on
Java_Card_Simulator_1and select Start.The Simulator starts and you can see the output in the Console view.
-
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
HelloWorldsample directory and check fileHelloWorld.launchto import theHelloWorldJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations… or Debug Configurations… to run or debug the imported
HelloWorldconfiguration
Running the Channels Sample in Eclipse
Run the Channels sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theChannelsproject to import theChannelsJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexp) files in the deliverables directory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theChannelsproject, to import theChannelsJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu and select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card View, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
Channelssample directory and check the fileChannels.launchto import theChannelsJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations … or Debug Configurations … to run or debug the imported
Channelsconfiguration.
Running the Utility Sample in Eclipse
Run the Utility sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theUtilityproject to import theUtilityJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexpfiles) in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theUtilityproject, to import theUtilityJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card View, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
Utilitysample directory and check fileUtility.launchto import theUtilityJava client launch configuration into Eclipse. -
Using Run menu, select Run Configurations … or Debug Configurations … to run or debug the imported
Utilityconfiguration.
Running the Wallet Sample in Eclipse
Run the Wallet sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theWalletproject to import theWalletJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexpfiles) in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theWalletproject, to import theWalletJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card View, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
Walletsample directory and check fileWallet.launchto import theWalletJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations … or Debug Configurations … to run or debug the imported
Walletconfiguration.
Running the ObjectDeletion Sample in Eclipse
Run the ObjectDeletion sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theObjectDeletionproject to import theObjectDeletionJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexpfiles) in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theObjectDeletionproject, to import theObjectDeletionJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card View, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
ObjectDeletionsample directory and check the fileObjectDeletion.launchto import theObjectDeletionJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations … or Debug Configurations … to run or debug the imported
ObjectDeletionconfiguration.
Running the SignatureMessageRecovery Sample in Eclipse
Run the SignatureMessageRecovery sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theSignatureMessageRecoveryproject to import theSignatureMessageRecoveryJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexpfiles) in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theSignatureMessageRecoveryproject, to import theSignatureMessageRecoveryJava client into your workspace -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card view, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
SignatureMessageRecoverysample directory, and select theSignatureMessageRecovery.launchfile to import theSignatureMessageRecoveryJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations… or Debug Configurations… to run or debug the imported
SignatureMessageRecoveryconfiguration.
Signing with Message Recovery
The order of operations for signing a message is as follows:
-
The user invokes a combination of the
updateandsignmethods to generate a signature based on message data provided by the user. -
The
signmethod returns an indication to the user of the portion of the message that was included as padding in the signature.This is required so that the user knows what remaining data must still be sent along with the signature block.
Verifying with Message Recovery
The order of operations for verifying a signed message is as follows:
- The user initializes the
signatureobject with signature at the very beginning so it can get the recoverable data at the earliest. - The user invokes a combination of the
updateandverifymethods to verify the signature based on the message data provided by the user. - The
verifymethod verifies the signature by comparing the accumulated hash with the hash in the message representative recovered during initialization.
Running the ArrayViews Sample in Eclipse
Run the ArrayViews sample using the Java client application.
Start Eclipse. Java_Card_Simulator_1 must have already been created.
-
Using the File menu, select Import > General > Projects from Folder or Archive and select the
appletdirectory from theArrayViewsproject to import theArrayViewsJava Card project into your workspace. If the build doesn’t start automatically, start it manually.The build puts the output from the converter (
cap,jca, andexp) files in thedeliverablesdirectory. -
Using the File menu, select Import > General > Projects from Folder or Archive, and select the
clientdirectory from theArrayViewsproject, to import theArrayViewsJava client into your workspace. -
If you do not see the Java Card view, go to the Window menu, select Show View > Other… In the list, expand Oracle Java Card SDK and select Java Card view.
-
In the Java Card view, right-click on
Java_Card_Simulator_1and select Start. The Simulator starts and you can see the output in the Console view. -
Using the File menu, select Import > Run/Debug > Launch Configurations, select the
ArrayViewssample directory and check the fileArrayViews.launchto import theArrayViewsJava client launch configuration into Eclipse. -
Using the Run menu, select Run Configurations … or Debug Configurations … to run or debug the imported
ArrayViewsconfiguration.