Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  





2 Performance  





3 Compiled Native Interface (CNI)  



3.1  Comparison of language use  







4 See also  





5 References  





6 External links  














GNU Compiler for Java






Deutsch
Español
فارسی
Français

Magyar

Polski
Português
Русский
Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikimedia Commons
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


GNU Compiler for Java
Developer(s)The GNU Project
Initial releaseSeptember 6, 1998; 25 years ago (1998-09-06)[1]
Final release

6.5[2] Edit this on Wikidata / 26 October 2018

Operating systemUnix-like
TypeCompiler
LicenseGNU GPL
Websitegcc.gnu.org

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

GCJ compiles Java source codetoJava 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.[5][6]

History[edit]

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.[7]

In 2007, a lot of work was done to implement support for Java's two graphical APIsinGNU 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.".[8] 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.[9] GCJ was removed from the GCC trunk on September 30, 2016.[10][11] Announcement of its removal was made with the release of the GCC 7.1, which does not contain it.[12] GCJ remains part of GCC 6.

Performance[edit]

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.[13]

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 use[edit]

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

We use CNI because we think it is a better solution, especially for a Java implementation that is based on the idea that Java is just another programming language that can be implemented using standard compilation techniques. Given that, and the idea that languages implemented using Gcc should be compatible where it makes sense, it follows that the Java calling convention should be as similar as practical to that used for other languages, especially C++, since we can think of Java as a subset of C++. CNI is just a set of helper functions and conventions built on the idea that C++ and Java have the *same* calling convention and object layout; they are binary compatible. (This is a simplification, but close enough.)

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

public class Int
{
   public int i;
   public Int(int i) { this.i = i; }
   public static Int zero = new Int(0);
}

one can use the class thus:

#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);
}

See also[edit]

References[edit]

  1. ^ Anthony Green, Cygnus Solutions. "GCJ announcement".
  • ^ "GCC Releases - GNU Project".
  • ^ "GCJ: The GNU Compiler for Java - GNU Project - Free Software Foundation (FSF)". Archived from the original on 2007-05-09. Retrieved 2010-04-22.
  • ^ Campbell, Bill (2013). Introduction to Compiler Construction in a Java World. CRC Press Taylor & Francis Group. ISBN 978-1-4398-6088-5. Retrieved 2014-02-06.
  • ^ "Compiling Java with GCJ | Linux Journal".
  • ^ "GNU Compiler for Java".
  • ^ "gcj to use Eclipse compiler as a front end". 2007-01-08. Archived from the original on 2007-05-09. Retrieved 2007-05-20.
  • ^ The GCJ FAQ
  • ^ GCC Looks To Turn Off Java, Replace With Go Or ADA
  • ^ Andrew Haley (September 30, 2016). "[gcc] Revision 240661".
  • ^ Tromey, Tom (October 2, 2016). "The Deletion of gcj". The Cliffs of Inanity. Retrieved October 3, 2016.
  • ^ "GCC 7 Release Series: Changes, New Features, and Fixes". Retrieved May 9, 2017.
  • ^ "GCJ: The GNU Static Java Compiler" (PDF). Archived from the original (PDF) on 2011-06-07. Retrieved 2009-08-02.
  • ^ The GCJ FAQ – GNU Project – Free Software Foundation (FSF)
  • ^ The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes Archived 2016-10-20 at the Wayback Machine
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=GNU_Compiler_for_Java&oldid=1139082986"

    Categories: 
    Free compilers and interpreters
    GNU Project software
    Java compilers
    Discontinued Java virtual machines
    Hidden categories: 
    Webarchive template wayback links
    Articles with short description
    Short description is different from Wikidata
     



    This page was last edited on 13 February 2023, at 07:58 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki