Question

I'm working on a school project where I am required to use the GNU Compiler for Java. I've always worked using the official Sun JDK and now I'm concerned about differences that might complicate my work.

I'm specially interested in which version of Java is the one supported by the latest GCJ compiler

Could someone shed some light in the differences between one or the other?

PS: I searched on google but failed in finding a recent answer

Was it helpful?

Solution

Since gcj is a compiler on top of GNU Classpath you need the differences between official JDK & GNU Classpath. For SUN JDK 1.4 see this for SUN JDK 1.5 see this one instead.

OTHER TIPS

If this answer should become the highest voted answer, it means that you should ask your prof to please reconsider why he's making you use such an unusual platform. In the real world, people use Sun JDKs predominantly. I don't see this changing much in the near future. It is a quality product, for the most part.

Can this really be helping you learn?

Well from it's home page:

http://gcc.gnu.org/java/

Compiled applications are linked with the GCJ runtime, libgcj, which provides the core 
class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically 
load and interpret class files, resulting in mixed compiled/interpreted applications. It 
has been merged with GNU Classpath and supports most of the 1.4 libraries plus some 1.5 
additions. 

From the GCJ website. It looks like the GNU compiler is an ahead-of-time compiler and not a just-in-time compiler like Sun's. So there's one difference right there. The front page is a little vague and references that it does have some byte-code interpretation facilities built into the libgcj runtime.

I'd be wary of any library that covers MOST of the 1.4 and 1.5 libraries. If you target 1.4 your probably alright. 1.6 and you're probably in for a world of hurt.

Bear in mind if GCJ can only INTERPRET class files then it could be much slower running uncompiled code than Sun's JIT compiler.

I have run into subtle differences in date parsing last time I looked.

AS the gnu JVM has not passed the Java TCK you must basically treat it as a new platform with full testing needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top