Setting Java Compiler Options
To set Java compiler options:
- When using the recommended compiler (Java 17) or any Java compiler with a
version great than 7, it is mandatory to use the
"-source 7"
and"-target 7"
command line options. - Compile your class files with the Java Development Kit compiler's
-g
command line option.
The "-source 7"
and "-target
7"
command line options force the compiler to generate classes with
class major version 51, which is the maximum and recommended class version for the
Converter input class files.
The -g
option causes the compiler to generate the LocalVariableTable
attribute in the class file. The Converter uses this attribute to determine local variable types.
If you do not use the -g
option, the Converter attempts to determine
the variable types on its own. This is expensive in terms of processing and might
not produce the most efficient code. You must also compile your class files with the
-g
option if you want to generate a debug component in the CAP
file by using the Converter's -debug
option.
Do not compile with the -O
option. The -O
option
is not recommended on the Java compiler command line, for the following reasons:
-
This option is intended to optimize execution speed rather than minimize memory usage. Minimizing memory usage is much more important in the Java Card environment than in other environments.
-
The
LocalVariableTable
attribute is not generated.