How is GCJ different from Sun Java?

Anthony Green green@redhat.com
Tue Nov 8 16:55:00 GMT 2005


On Tue, 2005-11-08 at 11:27 -0500, Ernest L. Williams Jr. wrote:
> Can someone explain what is the gcj in the GCC software?
> How is it different from Sun Java?

In many ways.  One key point to remember is that GCJ is not "Java",
however, many useful programs written in the Java Programming Language
will build and run perfectly well with gcj.

> Does gcj need a jvm? Does the jvm come from GNU?

The situation is bit confusing.  I like thinking of "GCJ" as the project
name, encompassing all of the following bits.  "gcj", on the other hand,
is the name of the GNU compiler for the Java Programming Language.  The
gcj compiler will produce native- or byte-code.  Native code must link
against libgcj, which is a library encompassing what most people
consider the "JVM" and core class libraries.  It includes a garbage
collector, bytecode interpreter, bytecode verifier, class libraries,
etc.  Bytecode produced by gcj may be executed with "gij", which is a
trivial program that simply uses libgcj to load and execute the
bytecode, somewhat like the "java" program from Sun.

> Can we mix and match java libraries from SUN and GNU?

This is unwise at best, and impossible at worst - for various differing
reasons.

> Does gcj have a good graphics library (e.g. swing)?

GCJ includes some AWT and SWING support.  Many useful programs run, but
many do not.  This is an ongoing effort and we welcome help.

> Is gcj completely compliant with SUN's definition of java?

Definitely not.

> All of these questions were generated when I started running "Native
> Eclipse" on Fedora Core 4.

Great.  I believe "Native Eclipse" is a misnomer, and we should really
be calling it "Fedora Eclipse".  Unfortunately this renaming hasn't been
a priority with anybody.

You should still be able to run this version of Eclipse with Sun's JVM
if you install it using the JPackage steps, and switch to the sun
"alternative".  Follow up on fedora-devel-java-list@redhat.com for any
further discussion.

AG




More information about the Gcc-help mailing list