The GNU Compiler for Java (GCJ) is a
free
Free may refer to:
Concept
* Freedom, having the ability to do something, without having to obey anyone/anything
* Freethought, a position that beliefs should be formed only on the basis of logic, reason, and empiricism
* Emancipate, to procur ...
compiler for the
Java programming language. It was part of the
GNU Compiler Collection for over ten years but as of 2017 it is no longer maintained and will not be part of future releases.
GCJ compiles Java
source code to
Java virtual machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
(JVM)
bytecode
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
or to
machine code for a number of
CPU architectures. It could also compile
class files and whole
JARs
A jar is a rigid, cylindrical or slightly conical container, typically made of glass, ceramic, or plastic, with a wide mouth or opening that can be closed with a lid, screw cap, lug cap, cork stopper, roll-on cap, crimp-on cap, press-on cap, ...
that contain bytecode into machine code.
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
An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ce ...
Compiler for Java as a front-end.
In 2007, a lot of work was done to implement support for Java's two graphical
APIs in
GNU Classpath:
AWT and
Swing
Swing or swinging may refer to:
Apparatus
* Swing (seat), a hanging seat that swings back and forth
* Pendulum, an object that swings
* Russian swing, a swing-like circus apparatus
* Sex swing, a type of harness for sexual intercourse
* Swing rid ...
. 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
Swing or swinging may refer to:
Apparatus
* Swing (seat), a hanging seat that swings back and forth
* Pendulum, an object that swings
* Russian swing, a swing-like circus apparatus
* Sex swing, a type of harness for sexual intercourse
* Swing rid ...
that may be usable.". 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. GCJ was removed from the GCC
trunk
Trunk may refer to:
Biology
* Trunk (anatomy), synonym for torso
* Trunk (botany), a tree's central superstructure
* Trunk of corpus callosum, in neuroanatomy
* Elephant trunk, the proboscis of an elephant
Computing
* Trunk (software), in rev ...
on September 30, 2016. Announcement of its removal was made with the release of the GCC 7.1, which does not contain it. 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.
Compiled Native Interface (CNI)
The Compiled Native Interface (CNI), previously named "Cygnus Native Interface", is a
software framework
In computer programming, a software framework is an abstraction in which software, providing generic functionality, can be selectively changed by additional user-written code, thus providing application-specific software. It provides a standard ...
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 machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
s.
Comparison of language use
The authors of CNI claim for various advantages over JNI:
CNI depends on Java classes appearing as C++ classes. For example,
[The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes ]
given a Java class,
public class Int
one can use the class thus:
#include
#include
Int *mult(Int *p, int k)
See also
*
Excelsior JET (Excelsior Java native code compiler)
*
IcedTea
*
Kaffe
*
SableVM
*
JamVM
*
Apache Harmony
Apache Harmony is a retired Open-source software, open source, free Java implementations, free Java implementation, developed by the Apache Software Foundation. It was announced in early May 2005 and on October 25, 2006, the Board of Directors ...
*
Jikes
*
GraalVM - GraalVM's Native Image functionality is an ahead-of-time compilation technology that produces executable binaries of class files.
*
Java virtual machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
*
Free Java implementations
*
Kotlin - Kotlin/Native is a technology for compiling Kotlin to native binaries that run without any JVM. It comprises a
LLVM-based backend for the Kotlin compiler and a native implementation of the Kotlin runtime library.
References
External links
*
*
*
*
{{DEFAULTSORT:Gnu Compiler For Java
Free compilers and interpreters
Java
Java compilers
Discontinued Java virtual machines