Template:Short description {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other The GNU Compiler for Java (GCJ) is a discontinued free compiler for the Java programming language. It was part of the GNU Compiler Collection.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>Template:Cite book</ref>
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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
HistoryEdit
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.<ref>
{{#invoke:citation/CS1|citation
|CitationClass=web
}}
</ref>
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.".<ref>The GCJ FAQ</ref> 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.<ref>GCC Looks To Turn Off Java, Replace With Go Or ADA</ref> GCJ was removed from the GCC trunk on September 30, 2016.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Announcement of its removal was made with the release of the GCC 7.1, which does not contain it.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> GCJ remains part of GCC 6.
PerformanceEdit
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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
Compiled Native Interface (CNI)Edit
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 useEdit
The authors of CNI claim for various advantages over JNI:<ref>The GCJ FAQ – GNU Project – Free Software Foundation (FSF)</ref>
CNI depends on Java classes appearing as C++ classes. For example,<ref>The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes Template:Webarchive</ref> given a Java class,
<syntaxhighlight lang="java"> public class Int {
public int i; public Int(int i) { this.i = i; } public static Int zero = new Int(0);
} </syntaxhighlight>
one can use the class thus:
<syntaxhighlight lang="cpp">
- include <gcj/cni.h>
- include <Int>
Int *mult(Int *p, int k) {
if (k == 0) return Int::zero; // Static member access. return new Int(p->i * k);
} </syntaxhighlight>
See alsoEdit
- Excelsior JET (Excelsior Java native code compiler)
- IcedTea
- Kaffe
- SableVM
- JamVM
- Apache Harmony
- Jikes
- GraalVM - GraalVM's Native Image functionality is an ahead-of-time compilation technology that produces executable binaries of class files.
- Java virtual machine
- 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.
ReferencesEdit
External linksEdit
- {{#invoke:citation/CS1|citation
|CitationClass=web }}
- {{#invoke:citation/CS1|citation
|CitationClass=web }}
- {{#invoke:citation/CS1|citation
|CitationClass=web }}
- {{#invoke:citation/CS1|citation
|CitationClass=web }}
Template:Java Virtual Machine Template:Java (software platform)