The main feature of gcj is that it can compile programs written in
the Java programming language to native code. Most extensions that have been
added are to facilitate this functionality.
gcj makes it easy and efficient to mix code written in Java and C++.
See About CNI, for more info on how to use this in your programs.
libgcj system classloader. When trying to load a class
gnu.pkg.SomeClass the system classloader will first try to load the
shared library lib-gnu-pkg-SomeClass.so, if that fails to load the
class then it will try to load lib-gnu-pkg.so and finally when the
class is still not loaded it will try to load lib-gnu.so. Note that
all .s will be transformed into -s and that searching
for inner classes starts with their outermost outer class. If the class
cannot be found this way the system classloader tries to use
the libgcj bytecode interpreter to load the class from the standard
classpath. This process can be controlled to some degree via the
gnu.gcj.runtime.VMClassLoader.library_control property;
See libgcj Runtime Properties.
libgcj includes a special gcjlib URL type. A URL of
this form is like a jar URL, and looks like
gcjlib:/path/to/shared/library.so!/path/to/resource. An access
to one of these URLs causes the shared library to be dlopen()d,
and then the resource is looked for in that library. These URLs are
most useful when used in conjunction with java.net.URLClassLoader.
Note that, due to implementation limitations, currently any such URL
can be accessed by only one class loader, and libraries are never
unloaded. This means some care must be exercised to make sure that
a gcjlib URL is not accessed by more than one class loader at once.
In a future release this limitation will be lifted, and such
libraries will be mapped privately.
gcj will examine the
GCJ_PROPERTIES environment variable and change its behavior in
some ways. In particular GCJ_PROPERTIES holds a list of
assignments to global properties, such as would be set with the
-D option to java. For instance,
java.compiler=gcj is a valid (but currently meaningless)
setting.