问题
I am working on java card and i want to know:
- what is max and min size of an applet in java card and on which parameter it depends?
- How many applet we can install on smart card?
I am using:
- smart card type = contact card
- using java card 2.2.2 with jcop using apdu
回答1:
There is no official size limit (above the ones Robert already posted). Cards may have their own limits depending on available memory - but there is no fixed value for that; depends on what has already been installed, how their VM works internally and so on.
回答2:
I don't know a concrete limit for the applet size, however there are other limits that affect the maximum size:
According to the Java Card 2.2 Virtual Machine Specification the limits are as follows:
Package References: A package can reference at most 128 other packages.
Package Name: The fully qualified name of a package may contain a maximum of 255 characters. The package name size is further limited if it contains one or more characters which, when represented in UTF-8 format, requires multiple bytes.
Classes in a Package: A package can contain at most 255 classes and interfaces.
Interfaces: A class can implement at most 15 interfaces, including interfaces implemented by superclasses. An interface can inherit from at most 14 superinterfaces.
Static Fields: A class in an applet package can have at most 256 public or protected static non-final fields. A class in a library package can have at most 255 public or protected static non-final fields. There is no limit on the number of static final fields (constants) declared in a class.
Static Methods: A class in an applet package can have at most 256 public or protected static methods. A class in a library package can have at most 255 public or protected static methods.
Methods: A class can implement a maximum of 128 public or protected instance methods, and a maximum of 128 instance methods with package visibility. These limits include inherited methods.
Class Instances: Class instances can contain a maximum of 255 fields, where an int data type is counted as occupying two fields.
Arrays: Arrays can hold a maximum of 32767 fields.
回答3:
There is no specification that mentions the maximum size for an applet. It all depends on OS, so yeah you should definitely ask NXP.
来源:https://stackoverflow.com/questions/8628300/what-is-max-and-min-size-of-applet-in-java-card