What is conversion?

Julien SIMON

Conversion is the operation through which the class files of a package are turned into a CAP file. A host tool performs this operation: the converter.

The main reasons for conversion are:

  • The Java Card Virtual Machine doesn't support dynamic class loading. Thus, one must make sure that all classes are "pre-loaded" on the card before the application runs.
  • Card resources are extremely constrained, so costly operations like linking are better left performed on the host.
  • Some Java features are either optional or missing in Java Card (integer support, static initializers, etc); one must make sure that class files conform to the actual Java Card platform they are meant for.
  • An AID (Application Identifier) must be assigned to the package and the application.

Most Java Card vendors have implemented their own converter, mainly because Sun's converter wasn't available/reliable for a while. In theory, since the CAP file format is standardized, you could use any converter and then load the CAP file on any card. In practice, we have found at least one combination that doesn't work at all and crashes the card… So, if you plan on using a different converter than the one provided by your vendor, run a few tests to make sure they really are equivalent.