40

As of October 2010, is GNU's Java compiler dead? Are there any active alternatives (especially for compiling Java to native code)?

LLVM solutions would be preferred.

Community
  • 1
  • 1
Alon Gubkin
  • 53,054
  • 52
  • 181
  • 282

4 Answers4

27

You could use IKVM and Mono's ahead of time compiler to generate native code.

EDIT

There is an example at the bottom of this page.

mikerobi
  • 18,957
  • 5
  • 43
  • 42
  • 4
    IKVM does not create native code. It produce only another type of byte code for the .NET universe. – Horcrux7 Oct 27 '10 at 18:53
  • 3
    @Horcrux7, read my answer more carefully and actually visit the link. Mono can generate native machine code from .NET bytecode. So in combination with IKVM, you can produce native code. – mikerobi Oct 27 '10 at 19:03
  • 4
    Obviously whoever is down voting me didn't read the OP or my answer, or doesn't believe me. Actually look at the link I provided. He asked for alternatives for native code generation, and that is what I gave him. – mikerobi Oct 27 '10 at 20:33
  • Ok, you means AOT http://www.mono-project.com/AOT. Yes, it produce some type of native code. – Horcrux7 Oct 27 '10 at 20:41
  • 1
    @Horcrux7, AOT = ahead of time – mikerobi Oct 28 '10 at 00:30
  • how does this compare to the Android Runtime? – Janus Troelsen Feb 14 '15 at 14:53
  • 1
    @mikerobi Sorry if it sounds silly, but it says Mono and IKMV depends on GNU classpath, so if I want to use Oracle JDK, is it as simple as adding Oracle JDK to the class path? – Quazi Irfan May 10 '15 at 20:23
  • 1
    Now I'm confused: Is this a Windows-only or a cross-platform solution? – bluenote10 Jun 04 '15 at 16:54
  • @iamcreasy If it depends on GNU CLASSPATH it is dead, for the reasons enumerated in my answer. – user207421 Mar 09 '17 at 04:44
24

A more pertinent question would be whether it was ever really alive. Consider these issues, from its own website:

  • 1.2 support is 'still incomplete'.
  • 1.3 ditto.
  • The project was last updated over a year ago [as of October 2009].
  • Currently 'supports most of the 1.4 libraries plus some 1.5 additions.'
  • Doesn't support java.nio.
  • Doesn't support javax.naming ('complete but no providers').
  • Doesn't support javax.sql.
  • Doesn't support AWT or Swing.
  • Doesn't support localization via java.text.
  • State of java.security is 'unknown'.
  • Doesn't check permissions in java.lang.reflect.
  • Does it compile generics?
  • Huge chunks missing out of other packages, e.g. nearly 50% of java.util.
  • No annotations.
  • No script engine.
  • Nearly all of javax.xml.* (recursively) is missing.
  • No org.omg.CORBA.
  • Practically no org.w3c.
  • Current comparison with JDK 1.6 is here. Note that this appears to add percentages to give a completely meaningless total.

And note that it isn't billed as a 'Java compiler'. It is a compiler for a subset of Java known as GNU CLASSPATH. Which in turn hasn't been updated since Feb 2009.

If it isn't dead it is certainly lying down.

EDIT It's dead. GCJ is no longer listed as a GNU package. And after four years of zero activity we are entitled to assume the same about GNU CLASSPATH.

user207421
  • 289,834
  • 37
  • 266
  • 440
  • 2
    GNU Classpath was updated in March 2012: http://savannah.gnu.org/forum/forum.php?forum_id=7156 – Janus Troelsen Mar 13 '13 at 15:33
  • 1
    @JanusTroelsen And it has not been updated subsequently, even though I am writing this nearly three years after posting my answer, and six months after your comment. Proves the point, *nicht war?* I also don't see anything in that page that corrects even the majority of the numerous deficiencies I cited, directly from their own site. – user207421 Sep 13 '13 at 11:59
  • 3
    And pronounced dead by one of its authors, as of October 2016: http://tromey.com/blog/?p=911 – Matthieu Jan 02 '17 at 23:24
  • 1
    @Matthieu Well spotted. Reading that, and considering even just the first bullet point above, it would probably have been more accurate for me to say that GCJ was never alive in the first place. – user207421 Jan 03 '17 at 01:03
5

One alternative to compile Java to native is Excelsior JET.

Grodriguez
  • 20,528
  • 10
  • 53
  • 97
  • 2
    This project has been discontinued as of 2019: https://www.excelsiorjet.com/ (website will be taken down in the middle of June 2019). The only current Java-to-native compiler remaining today is https://graalvm.org as far as I know. – Renato May 26 '19 at 10:37
1

I think not that it is dead. It has only few important. Which result in a slow development. There are 3 fact because it has only few important today:

  • It based on the GNU Classpath. Since Java is open source (OpenJDK) there is no large need for another open source Java. This has slow down the development speed.
  • The Java was faster in the last years. The GCJ output is not faster. In many cases it is slower.
  • The GNU Classpath has many incompatibility.
Horcrux7
  • 21,867
  • 21
  • 85
  • 134