Page 1 of 1

How to reduce the size of javacard applet

Posted: Tue May 09, 2017 8:24 am
by mhsnmaghsoodloo
Hello everyone,
I wrote an applet which has 19 KB size on disk. It has three classes. The first one is extended from Applet, the second one has static functions and third one is a class that i create an instance from it in my applet.

I have three questions:
1- Is there any way to find out how much size has taken by my applet instance in my javacard?
2- is there any tool to reduce the size of a javacard applet (.cap file)?
3- Can you explain rules that help me to reduce my applet size?

Regards,
Mohsen.

Re: How to reduce the size of javacard applet

Posted: Tue May 09, 2017 10:40 pm
by UNKNwYSHSA
1 Write an applet to get card available memory size; You can get your applet size in card with following steps:
- Get card memory size size1;
- Load your applet to the card;
- Get card memory size size2;
- Your applet uses memory size: size1 - size2.
Note: The uses size are different for different card, because the different implementation of each card.
2 Remove the argument "-debug" of converter. The debug component in the CAP file will not be generated. This method can only reduce CAP file size, not applet size.
3 There are some rules i think of:
- Are there any common functions in your code? You can write them as common method;
- Are there any const data in your code? you can write it when you use it, not pre-defined in your applet;

Re: How to reduce the size of javacard applet

Posted: Sun May 14, 2017 6:43 am
by mhsnmaghsoodloo
Thank you very much, it was great answer.

Re: How to reduce the size of javacard applet

Posted: Sun May 14, 2017 9:45 pm
by UNKNwYSHSA
;)