Programming Large Applications and Libraries
The introduction of Extended CAP files (see Programming Large Java Card Applications With Multiple Packages) in Java Card version 3.1 facilitates the development of large applications for the Java Card platform.
However, there might be scenarios where developers want to continue using the Compact CAP file format. For example, to target Java Card products that do not support Extended CAP files. When using the compact CAP file format, the most important limitation on a package is the 64 KB limitation on the maximum component size. This is especially true for the Method component. If the size of an application's Method component exceeds 64 KB, then the Java Card Converter doesn't process the package and returns an error.
You can overcome the component size limitation by dividing the application into separate application and library components. The Java Card platform has the ability to support library packages. Library packages contain code, which can be linked and reused by several applications. By dividing the functionality of a given application into application and library packages, you can increase the size of the components. It is important to note that there are important differences between library packages and applet packages:
-
In a library package, all public fields are available to other packages for linking.
-
In an applet package, only interactions through a shareable interface are allowed by the firewall.
Therefore, you must not place sensitive or exclusive-use code in a library package. It must be placed in an applet package, instead.
Handling a Package as a Separate Code Space
Several applications and API functionality can be installed in the smart card simultaneously by handling each package as a separate code space. This technique lets you exceed the 64KB limit, and provide full Java Card API functionality and support for complex applications requiring larger amounts of code.