gcj has options to control where it looks to find files it needs. For instance, gcj might need to load a class that is referenced by the file it has been asked to compile. Like other compilers for the Java language, gcj has a notion of a class path. There are several options and environment variables which can be used to manipulate the class path. When gcj looks for a given class, it searches the class path looking for matching .class or .java file. gcj comes with a built-in class path which points at the installed libgcj.jar, a file which contains all the standard classes.
In the below, a directory or path component can refer either to an actual directory on the filesystem, or to a .zip or .jar file, which gcj will search as if it is a directory.
-Iare kept in order and prepended to the class path constructed from all the other options. Unless compatibility with tools like
javacis important, we recommend always using
-Iinstead of the other options for manipulating the class path.
The final class path is constructed like so:
CLASSPATHenvironment variable is specified, then its value is appended. Otherwise, the current directory (
".") is appended.
--bootclasspathwas specified, append its value. Otherwise, append the built-in system directory, libgcj.jar.
--extdirswas specified, append the contents of the specified directories at the end of the class path. Otherwise, append the contents of the built-in extdirs at
The classfile built by gcj for the class
(and placed in
libgcj.jar) contains a special zero length
gnu.gcj.gcj-compiled. The compiler looks for this
attribute when loading
java.lang.Object and will report an error
if it isn't found, unless it compiles to bytecode (the option
-fforce-classes-archive-check can be used to override this
behavior in this particular case.)
java.lang.Objectand issue an error if it isn't found.