Programming Large Applications and Libraries

With the introduction of Extended CAP files (see Programming Large Java Card Applications with Multiple Packages) since Java Card, Version 3.1, Java Card facilitates the development of large applications for its 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.