javac -processor com.oracle.javacard.stringproc.StringConstantsProcessor \ -processorpath "JCDK_HOME/lib/tools.jar;JCDK_HOME/lib/api_classic_annotations.jar" \ ANY-OTHER-JAVAC-OPTIONS FILES-TO-COMPILEWhere JCDK_HOME points to the root directory where the Java Card 3 SDK is installed.
The string annotation processor generates the source files for the string constant pool classes
defined in the application or library source files to be compiled. These generated source files
are created in the same directory where javac
puts the class files.
package com.sun.jcclassic.samples.stringlib; import javacardx.annotations.*; @StringPool(value = { @StringDef(name = "Hello", value = "Hello California!")}, export = true, name = "LibStrings") public class StringHandlingLib { ... }the annotation processor will generate the following string constant pool class:
package com.sun.jcclassic.samples.stringlib; public final class LibStrings { public final byte[] Hello = new byte[] {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x21, }; public LibStrings() { } }For the following annotated applet class:
package com.sun.jcclassic.samples.stringapp; import javacardx.annotations.*; @StringPool(value = { @StringDef(name = "S1", value = "Hello World!"), @StringDef(name = "S1_expected", value = "llo "), @StringDef(name = "S2", reference = "com.sun.jcclassic.samples.stringlib.LibStrings.Hello") }, name = "AppStrings") public class StringHandlingApp extends Applet { ... }the annotation processor will generate the following string constant pool class:
package com.sun.jcclassic.samples.stringapp; final class AppStrings { private static com.sun.jcclassic.samples.stringlib.LibStrings __x0; static final byte[] S1 = new byte[] {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, }; static final byte[] S1_expected = new byte[] {0x6c, 0x6c, 0x6f, 0x20, }; static byte[] S2; static void importLibConstants() { __x0 = new com.sun.jcclassic.samples.stringlib.LibStrings(); S2 = __x0.Hello; } }Copyright © 1998, 2015, Oracle and/or its affiliates. All rights reserved.