GNU Compiler for Java explained

GNU Compiler for Java
Logo Size:70px
Developer:The GNU Project
Released:[1]
Discontinued:yes
Operating System:Unix-like
Genre:Compiler
License:GNU GPL

The GNU Compiler for Java (GCJ) is a discontinued free compiler for the Java programming language. It was part of the GNU Compiler Collection.[2] [3]

GCJ compiles Java source code to Java virtual machine (JVM) bytecode or to machine code for a number of CPU architectures. It could also compile class files and whole JARs that contain bytecode into machine code.[4] [5]

History

The GCJ runtime-libraries original source is from GNU Classpath project, but there is a code difference between the libgcj libraries. GCJ 4.3 uses the Eclipse Compiler for Java as a front-end.[6]

In 2007, a lot of work was done to implement support for Java's two graphical APIs in GNU Classpath: AWT and Swing. Software support for AWT is still in development. "Once AWT support is working then Swing support can be considered. There is at least one free-software partial implementations of Swing that may be usable.".[7] The GNU CLASSPATH was never completed to even Java 1.2 status and now appears to have been abandoned completely.

As of 2015, there were no new developments announced from GCJ and the product was in maintenance mode, with open-source Java toolchain development mostly happening within OpenJDK.[8] GCJ was removed from the GCC trunk on September 30, 2016.[9] [10] Announcement of its removal was made with the release of the GCC 7.1, which does not contain it.[11] GCJ remains part of GCC 6.

Performance

The compilation function in GCJ should have a faster start-up time than the equivalent bytecode launched in a JVM when compiling Java code into machine code.[12]

Compiled Native Interface (CNI)

The Compiled Native Interface (CNI), previously named "Cygnus Native Interface", is a software framework for the GCJ that allows Java code to call, and be called by, native applications (programs specific to a hardware and operating-system platform) and libraries written in C++.

CNI closely resembles the JNI (Java Native Interface) framework which comes as a standard with various Java virtual machines.

Comparison of language use

The authors of CNI claim for various advantages over JNI:[13]

CNI depends on Java classes appearing as C++ classes. For example,[14] given a Java class,

public class Int

one can use the class thus:

  1. include
  2. include

Int *mult(Int *p, int k)

See also

External links

Notes and References

  1. Web site: GCJ announcement. Anthony Green, Cygnus Solutions.
  2. Web site: GCJ: The GNU Compiler for Java - GNU Project - Free Software Foundation (FSF) . 2010-04-22 . dead . https://web.archive.org/web/20070509055923/http://gcc.gnu.org/java/ . 2007-05-09 .
  3. Book: Campbell, Bill . 2013 . Introduction to Compiler Construction in a Java World . CRC Press Taylor & Francis Group . 978-1-4398-6088-5 . 2014-02-06.
  4. Web site: Compiling Java with GCJ | Linux Journal.
  5. Web site: GNU Compiler for Java.
  6. Web site: gcj to use Eclipse compiler as a front end . 2007-01-08 . 2007-05-20 . dead . https://web.archive.org/web/20070509055923/http://gcc.gnu.org/java/ . 2007-05-09 .
  7. https://gcc.gnu.org/java/faq.html#2_4 The GCJ FAQ
  8. https://www.phoronix.com/scan.php?page=news_item&px=MTUwOTA GCC Looks To Turn Off Java, Replace With Go Or ADA
  9. Web site: [gcc] Revision 240661]. September 30, 2016. Andrew Haley.
  10. Web site: The Deletion of gcj. Tromey. Tom. October 2, 2016. The Cliffs of Inanity. October 3, 2016.
  11. Web site: GCC 7 Release Series: Changes, New Features, and Fixes. May 9, 2017.
  12. Web site: GCJ: The GNU Static Java Compiler . 2009-08-02 . https://web.archive.org/web/20110607102558/http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/gcj2.pdf . 2011-06-07 . dead .
  13. https://gcc.gnu.org/java/faq.html#2_3 The GCJ FAQ – GNU Project – Free Software Foundation (FSF)
  14. The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes