Re: Load Applet to Java card
Applets are loaded into the card through a CAP file . This file is generated in two steps . First, the Java classes are compiled in a conventional manner (with javac. The only difference being the use of Java Card API and not the Java standard ) to files . class. Then , a conversion tool (converter), provided by the JavaCard Development Kit , includes all classes of the same package in a single file CAP . It also makes a number of checks on the code ( check the size of integers manipulated by example) and the linking between the classes .
Re: Load Applet to Java card
We will resume the application developed in the first part of TP , but this time, we will perform the compilation step by hand. Get the source file MonApplet.java and place it in a new directory (eg ~ / ELECINF359/upload/monpackage) . The compilation is done using the following command :
Code:
javac ELECINF359/upload MyPackage / MonApplet.java - classpath ~ / ELECINF359/jc211/bin/api21.jar -source 1.3- target 1
Re: Load Applet to Java card
Parameter classpath tells the compiler to take into account the JavaCard API ( and not the API standard Java SE) , and parameters source and target tell the compiler to generate bytecode compatible with Java Virtual Machine version 1.3 ( so we can not use the latest Java such as generics ) because the virtual machine from the card does not support newer versions.
Re: Load Applet to Java card
You need to use the tool converter provided by the SDK to generate the JavaCard CAP file from the class we just compile. To be sure the environment , re - export the environment variables of the first part of TP (in practice , the command converter is a script that starts the execution of a class using Java virtual machine , it is necessary that it be properly configured).
Code:
~ / ELECINF359/upload $ export JAVA_HOME = / usr
~ / $ export ELECINF359/upload JC_HOME = ~ / ELECINF359/java_card_kit-2_2_2
~ / ELECINF359/upload $ export PATH = $ PATH : $ JC_HOME / bin
Re: Load Applet to Java card
Mails We will modify the code of the client application written in the first part to it now communicates with the card and not with the simulator. Good news , recent releases of Java virtual machines natively integrate everything needed to communicate with a Card Reader ( provided he has a driver is PC / SC ) and a map. The source code of the client application amended Maclasse2.java. Compile ( in Eclipse for example ) the class and test the communication with the card.