As of GCC 7, the GCC Java frontend and associated libjava runtime library have been removed from GCC. The information on this page is kept here for reference but only applies to GCC 6 and earlier.
Introduction
GCJ stands for the GNU Compiler for the Java Programming Language. Within GCC, it comprises the Java programming language front-end (gcc/java), a runtime library (libjava) and other helper libraries (boehm-gc, libffi and zlib). Most of the runtime library implementation is shared with the GNU Classpath project.
GCJ can compile Java source files to native code or to Java bytecode and can also compile Java bytecode to native code.
History
In the late 1990s, Cygnus Solutions started a project to create an ahead-of-time (AoT) native compiler for Java based on GCC and primarily targeted at embedded systems. The first version was released in 1998. It was merged into the GCC CVS repository by late 2000. An early name for GCJ used to be gjavac.
Status
GCJ supports most of the Java Language Specification and a fairly large number of runtime APIs when compared to Sun's JDK 1.4. It does not have any support for the newer language and runtime features introduced in JDK 1.5.
GCJ has been ported to many architectures, though not as many as those supported by the C front-end in GCC.
GCJ_Bug_Digest (not up to date)
Binary Compatibility ABI
GCC 4.0 includes a preview implementation of a new Binary Compatibility ABI for GCJ for pre-compiled Java applications. It is enabled by compiling Java bytecode using the -findirect-dispatch flag (and right now, some other flags, although we hope to simplify that). See How_to_BC_compile_with_GCJ for full details.
Tips and Hints
This section is for useful information for users and/or developers of gcj which hasn't yet made it into the documentation (which, incidentally, can be accessed with "info gcj" on a gnu system).
Debugging_tips_for_libgcj - Explains how to debug both Java code that has been compiled to native code and interpreted bytecode
Debugging_the_Java_frontend - For compiler hackers
Statically_linking_libgcj - Tips on statically linking libgcj
Building GCJ for Windows - How to build GCJ for Windows (MinGW).
Unrealized GCJ Improvement Opportunities
Ideas about how GCJ could be improved.
GCJ_Optimization_Ideas - Ideas about how to optimize code generated by the gcj compiler.
Hackers
Here is an alphabetically ordered list of some current and past GCJ hackers:
- David Daney
- Jeff Sturm
Related Pages
External Links
"Cygnus Implementation of the Java Language" - an early Cygnus (since acquired by Red Hat) design document for GCJ.
The Mauve Project - contains testsuites for testing a Java compiler (Jacks), a Java runtime (Mauve) and the Java bytecode verifier (verify).
"Supporting Binary Compatibility with Static Compilation" (PDF) - an early paper exploring how Java binary compatibility can be supported in ahead-of-time statically compiled executables.
Planet Classpath - a syndication of the weblogs of many Free Java hackers.
GNU Classpath Wiki - Everything about GNU Classpath should be in here: Information for developers, users and marketing brag
GNU Classpath CVS diffs - Daily generated diffs between GNU Classpath, libgcj and Kaffe CVS.