JavaCodeCompact

java [ Java options ] JavaCodeCompact [ options ] filename ...

Description

JavaCodeCompact combines one or more Java class files and produces a target-system dependent C file that contains the given classes in a preloaded format that can be compiled and linked with the Java virtual machine.

Linking Java Programs

Here is an outline of the conventional mechanism for class loading:

JavaCodeCompact provides an alternate means of program linking and symbol resolution, one that provides a less-flexible model of program building, but which helps reduce the VM's bandwidth and memory requirements.

JavaCodeCompact can:

Java Options

This program often has to be run with an increased maximum heap size. -mx20m increases the heap to 20MB.

Options

filename
Designates the name of a file to be used as input, the contents of which should be included in the output. File names are not modified by any pathname calculus. File names with a .class suffix are read as single class files. File names with .jar or .zip suffixes read as Zip files. Class files contained as elements of these files are read. Other elements are silently ignored.

-o outfilename
Designates the name of the output file to be produced. Conventionally, the file name ends with .c for C language output, but this is not important to the operation of the program. In the absence of this option, a file is produced with a name based on that of the first input file, stripped of pathname prefix and any suffix, to which a suffix is appended. If the -q option is given, the suffix is ".c", otherwise ".mclass" is used.
-q
Enables generation of field and method tables, and the transformation of method code to its "quickened" form.

JavaCodeCompact determines the offset of every instance variable and the methodtable offset of each non-static method for each class in the generated file. It requires that the complete inheretance hierarchy for each class be present in the set of classes linked.

Many Java bytecode instructions refer to symbolic quantities such as the offset of a field or of a method, or simply to the name of a type. Normally, the Java Virtual Machine resolves these referenced upon first executing the instructions, and re-writes the instruction in place. This yields non-ROMable code. Java bytecodes resolved and quickened at link time are read-only and thus ROMable. Instructions referring to symbols not resolved remain un-quick, and thus writable.

This option should only be used on the ultimate link step.

-qlossless
The same as -q, but leaves the resulting bytecode amenable to just-in-time compilation. See The JIT Compiler Interface Specification for a description of lossless quick opcodes.

-c
Cumulative linking. Classes unresolved by the linking of class files explicitly listed as linker arguments are searched for using the -classpath option, and linked as they are found.

-classpath path
Specifies the path JavaCodeCompact uses to look up classes. Directories and Zip files are separated by the delimeter defined by java.io.File.pathSeparatorChar, which is generally a colon. Multiple classpath options are cumulative, and are searched left-to-right. This option is only used in conjunction with the -c cumulative-linking option, as well as the -memberlist selective-linking option.

-headers target_directory
Writes C language header files, à la javah for all the classes read as input. Files are written in the indicated target directory. Header files unchanged remain untouched. This option should only be used on the ultimate link step.

-stubs filename
Writes C language interface stubs, à la javah -stubs, for all native (but non-JNI) methods in the classes read as input. The stubs file is written to the indicated filename. This option should only be used on the ultimate link step.

-trace
Indicates that interface stubs should have tracing information written into them. Is only of interest if the -stubs directive is also given.

-jniClass classname
Indicates that the native methods of the named class all use JNI calling conventions (as opposed to the less formal and less portable interfaces used prior to JDK1.1). This affects generation of C-language linkage and stubs, and should only be used on the ultimate link step. It does not affect generation of headers: old-style headers are always produced if the -headers option is given. JNI headers must be generated using javah -jni.

If the last component of the classname is *, then its prefix is treated as a package, all classes of which use JNI linkage. Thus, for instance,

-jniClass java.lang.*
would specify JNI linkage for all the native methods of all the classes in the java.lang package.

-memberlist filename (EmbeddedJava development only)

Performs selective loading as directed by the indicated file. This file is an ASCII file, as produced by JavaFilter, containing the names of classes and class members. The file is read, and the named class members are sought along the path indicated by the -classpath directive. Of the classes loaded in this manner, only the named members will be included in the output -- any other members will be discarded.

N.B.: Classes loaded by the combination of -memberlist and -classpath are loaded selectivly. Class files named directly on the command line are loaded entirely.

-v
Turns up the verbosity of the linking process. This option is cumulative. Currently up to three levels of verbosity are understood. This option is really only of interested as a debugging aid.

-g
Enables writing of line-number tables in the output, a local variables table and source file names, if the information is available in the input data. These tables are not written by default. This option also supresses the code inlining optimization. For use only when a C language output file is to be produced.

-imageAttribute target-dependent_attribute
Pass flags on to the target-specific output file writer. For use only when a memory image output file is to be produced.

-s
Create a single shared constant pool to replace all private per-class constant pools.

See Also

The Java Virtual Machine Specification by Lindholm and Yellin. Addison Wesley, 1996.

The JIT Compiler Interface Specification.

jar

javac