In addition to the many
gcc options controlling code generation,
gcj has several options specific to itself.
mainmethod should be invoked when the resulting executable is run. 1
--main. It defines a system property named name with value value. If value is not specified then it defaults to the empty string. These system properties are initialized at the program's startup and can be retrieved at runtime using the
gcjto generate bytecode (
.classfiles) rather than object code.
gcjto compile the contents of a given file to object code so it may be accessed at runtime with the core protocol handler as
. Note that resource-name is the name of the resource as found at runtime; for instance, it could be used in a call to
ResourceBundle.getBundle. The actual file name to be compiled this way must be specified separately.
-C, this causes all generated
.classfiles to be put in the appropriate subdirectory of directory. By default they will be put in subdirectories of the current working directory.
gcjgenerates code which checks the bounds of all array indexing operations. With this option, these checks are omitted, which can improve performance for code that uses arrays extensively. Note that this can result in unpredictable behavior if the code in question actually does violate array bounds constraints. It is safe to use this option if you are sure that your code will never throw an
gcjthere are two options for writing native methods: CNI and JNI. By default
gcjassumes you are using CNI. If you are compiling a class with native methods, and these methods are implemented using JNI, then you must use
-fjni. This option causes
gcjto generate stubs which will invoke the underlying JNI methods.
gcjwill try to optimize the way calls into the runtime are made to initialize static classes upon their first use (this optimization isn't carried out if
-Cwas specified.) When compiling to native code,
-fno-optimize-static-class-initializationwill turn this optimization off, regardless of the optimization level in use.
The linker by default looks for a global function named
main. Since Java does not have global functions, and a
collection of Java classes may have more than one class with a
main method, you need to let the linker know which of those
main methods it should invoke when starting the application.