Rate this page del.icio.us  Digg slashdot StumbleUpon

Open source project: OpenJDK

by Andrew Haley

Contributing writer: Thomas Fitzsimmons

At the 2006 JavaOne conference, Sun announced plans to open source Java. This wasn’t exactly a surprise to those of us working on Java at Red Hat, given that there had been rumblings before. But this was a real announcement. We were immediately interested in learning exactly which license Sun would choose. Even if it was a legitimate open source license, it still might not allow us to combine our code with Sun’s.

We have been working on free Java for many years–most particularly through gcj, a project started at Cygnus in 1998 by a developer named Per Bothner. Gcj has been steadily improving over the years, but still wasn’t fully Java-compatible, partly because we couldn’t get permission to run the official Java compatibility test suite. We had also been working on GNU Classpath, which is GNU’s free replacement for the core Java class libraries from Sun. We were very curious to see the “official version.”

We were thrilled to hear Sun announce in November 2006 that it had selected the exact same license as GNU Classpath.

When the complete Java source code–now called OpenJDK–was released on May 9, 2007, there were a few challenges. Most notably, some of the code was missing. Over the years, Sun had licensed Java libraries from a variety of sources, some of which would not allow their code to be open sourced. In order to work with this encumbered code, Sun provided some “binary plugs” that were copied into the build. This presented a problem as Fedora’s rules don’t allow the inclusion of anything that isn’t open source. It’s hard for us to maintain confidence in code we can’t see.

We were 95 percent of the way to a truly free Java. The way to fill that last five percent became clear: use the code from GNU Classpath. We later discovered that one of the reasons Sun selected the Classpath license was so that they could work with the Classpath developers and the Linux distributions that already used GNU Classpath. This was a great vote of confidence.

We needed to start a project to combine OpenJDK with the GNU Classpath code. This project could have been hosted within Red Hat, but we didn’t want this to be seen as Red Hat only. Classpath came to the rescue and Mark Wielaard, GNU Classpath maintainer, set up the IcedTea project. This is the repository for the totally free version of OpenJDK.

Bootstrapping was another not-so-obvious problem. Much of OpenJDK is written in Java. Sun built the first release of OpenJDK with its unfree Java. Fedora, however, doesn’t allow packages to depend on any unfree software. This time, it was gcj that came to the rescue. Since gcj is completely free software, we could use it to build OpenJDK. This also ensured that unfree code couldn’t “leak” into our OpenJDK package during the build process.

Over the next few weeks, a team within Red Hat worked vigilantly to create the OpenJDK and GNU Classpath hybrid that was to become IcedTea. Less than a month after we received the OpenJDK source code, we were able to release IcedTea 1.0. In a few cases, we had to create non-functional stubs for code we didn’t have, but the result was good enough to run many of the Java applications in Fedora. Since then, Sun has created replacements for many of the binary plugs and we have gradually been able to remove much of the GNU Classpath code.

The OpenJDK that Sun released only ran on i386 and AMD-64 machines. Fedora runs on other systems, in particular those based on the PowerPC. To solve this problem, we started an IcedTea porting project. That project produced an interpreter-only OpenJDK port for the PowerPC, based on Sun’s C++ interpreter. This later became Zero, a truly portable “zero assembler” version. As you might expect, a pure interpreter is not as fast as the high-performance JIT (Just In Time) compilers often used in Java implementations, but we’re working on that.

The OpenJDK code that Sun released was a preview of Java SE Version 7 rather than an implementation of Version 6. Java SE Version 7 has not yet been released and neither has its specification, so IcedTea cannot officially be certified as compatible with anything. Despite this, it works so well that we shipped it with Fedora 8.

Though it is not officially part of the Java platform, for many Fedora users the Java web browser plugin is essential to a complete desktop experience. Sun did not open source its Java plugin with OpenJDK, presenting another opportunity to utilize IcedTea. GNU Classpath includes a Java plugin named, for historical reasons, gcjwebplugin. By adapting Sun’s applet viewer code slightly, we were able to integrate gcjwebplugin into IcedTea to provide a working Java plugin. This plugin was released as part of Fedora 8, and is installed by default on both x86 and x86-64. This was the first time a 64-bit Java plugin had been available to Fedora users; unfree Java plugins are 32-bit only.

The plugin is closely related to the other Java deployment technology, Java Web Start, which also currently lacks an open source replacement. We’re working on IcedTea to complete the support for both the plugin and Java Web Start. We’ve integrated and extended NetX, an open source web start implementation; it is now nearing release-readiness for Fedora. We’re making good progress on gcjwebplugin‘s two missing features: a LiveConnect Java/JavaScript bridge and signed applet verification. Future Fedora releases will boast increasingly better integration of these Java deployment technologies.

After the release of Fedora 8, the lack of an open source version of Java SE Version 6 became more of a problem. Developers were using IcedTea on Fedora, but as it was a preview of Version 7, there was a risk that people might rely on libraries and interfaces that would change when Version 7 was released. Sun started an OpenJDK 6 project, which took the OpenJDK 7 code base and made the changes necessary for it to be compatible with Version 6. We immediately realized that this would be far more useful to Fedora users and developers.. After some discussion, we decided to base the next Fedora’s OpenJDK on the Java 6 code.

At the same time, Sun decided to allow Fedora to use its OpenJDK trademark for IcedTea. This makes perfect sense as there are now so few binary plugs needed to build OpenJDK that it’s a distinction without a real difference from a user’s point of view. Fedora 9′s package is now called OpenJDK, not IcedTea, and it is based on OpenJDK 6.

We have also been permitted to run the official Java SE Compatibility test suite on OpenJDK. This test suite has a crucial role in Java: to be called Java-compatible, an implementation must pass every one of tens of thousands of tests. Simply running this test suite is a huge effort. We still fail some tests, so our OpenJDK package cannot yet claim to be Java compatible, but we are working on it. Watch this space. When we pass the last few tests, we will finally be able to say “Java is free!”

19 responses to “Open source project: OpenJDK”

  1. Per Bothner says:

    A nit-pick: We started working on gcj in 1996, as you can see in gcc/java/ChangeLog. Engineers who were involved early include Tom Tromey, Anthony Green, Andrew Haley (all of whom still work for Red Hat and are still somewhat involved in Java), myself (now working for SUN – which was made possible by SUN “freeing” JDK), Alex Petit-Bianco (now at Google), Warren Levy, and Gordon Irlam.

  2. Stefan Krause says:

    What will the future bring for GCJ? Is Red Hat going to continue to support GCJ’s development or will Red Hat shift its focus to SUN’s hotspot VM?

  3. Andrew Haley says:

    gcj isn’t going away, and I recently have been working with Fedora and Debian developers on the gcj ARM GNU/Linux port. It seems to me that gcj still has some unique advantages — its own ecological niche, if you like. However, OpenJDK has some considerable advantages on large desktop systems. I expect to continue to divide my time between OpenJDK and gcj.

  4. Andrew Haley says:

    Per, thanks for the correction. I have no idea where I got 1998 from!

  5. Ville-Pekka Vainio’s blog » Blog Archive » My adventures with Fedora 9, part 2 says:

    [...] Now that Fedora 9 has OpenJDK, I removed Sun’s proprietary Java, which I had installed in /opt/, changed the java binary to the free one by running alternatives –config java, removed an sh script in /etc/profile.d/ which set the java paths to the proprietary JDK and removed the symbolic link to the proprietary java plugin I had in /usr/lib/mozilla/plugins/. I also installed the java-1.6.0-openjdk-devel and java-1.6.0-openjdk-plugin packages, so now I should have quite a complete open java stack. It’s not yet quite the same as the proprietary JDK, but it looks very promising. Here’s a Red Hat Magazine article about OpenJDK. [...]

  6. douglas baker says:

    wHERE CAN I get a copy OF fedora

  7. douglas baker says:

    where CAN I GET A COPY OF FEDORA?

  8. Seth H says:

    I sure hope we will be seeing netx enabled as default in fedora 10/rawhide.

    Icedtea netx worked wonders for me…and the developer of it (kung) said long ago that he saw no reason not to enable it as default. and with a gnome/looking frontend for signed verification….

    The future of Linux is looking so good right now.
    Though it’s a shame we did not see this stuff in 9.

  9. Mark Wielaard says:

    Douglas: See https://fedoraproject.org/en/get-fedora

    Seth: IcedTea NetX webstart is actually included in Fedora 9. It is in the java-1.6.0-openjdk-devel package. And it does work great! It runs Jake2 out of the box, what more do you want :) http://gnu.wildebeest.org/diary/2008/05/13/fedora-9-openjdk-update-is-awesome/

  10. Boycott Novell » Links 18/05/2008: More Large and Small Victories for Free Software says:

    [...] Open source project: OpenJDK [...]

  11. KEVIN O says:

    KEEP UP THE GREAT WORK NI LOVE FEDORA8 AND AM VERY HAPPY WITH ALL ITS FEATURES I RUN AS DUAL BOOT WITH VISTA ON A TOSHIBA LAPTOP W/ WIFI NO PROBLEMS

  12. Murray Trainer says:

    We need a 64-bit Firefox Java plugin that works with signed SSL applets. Is there a version out that works for Ubuntu?

    Thanks

    Murray

  13. Steve Nies says:

    Please forgive this newbie’s question. I have been trying hard (extensive web searches) to find a JVM that runs on low-cost SBCs using the ARM processor. I am encouraged to have found this group. The SBC I am considering using offers a Debian ARM Linux based distribution. Will OpenJDK run or Debian or should I switch to Fedora and use OpenJDK instead? Any help and/or web pointers would be much appreciated!

    Steve

  14. Xerxes Rånby says:

    Steve; OpenJDK6 for ARM is working!

    If you are using the Debian armel port then you can simply install prebuilt openjdk deb packages by running:
    apt-get install openjdk-6-jdk

    this will give you the full j2se using the interperted zero hotspot. If you want a jit then cacao vm is available. You can simply add the debian sid repositories and install openjdk6 using cacao by running:
    apt-get install cacao-oj6-jdk

    There exists of course jre packages as well: openjdk-6-jre and cacao-oj6-jre.

    These packages require Linux kernel 2.6.24 or later compiled with EABI. The openjdk binarys do run on fedora core 8 ARM as well as can be seen on these screenshots:
    http://labb.zafena.se/?p=1

    Cheers!
    Xerxes

  15. Anders Pallisgaard says:

    Xerxes: I have a Synology 107+ which is based on an ARMv5tejl. Will I be able to install the openjdk-6-jdk on that?

    If yes, do you know how I do that when I only have ipkg available (no apt-get, and I can’t figure out if apt-get can be installed on my Synology 107+)? I have tried to point my ipkg to http://people.ubuntu.com/~doko/java/openjdk6-armel/ but ipkg (version 0.99.163) seems to fail to read the file named Packages:

    ipkg_download: ERROR: Command failed with return value 1: `wget -q -P /opt/ipkg-TG8lPg http://people.ubuntu.com/~doko/java/openjdk6-armel/Packages

    I can see that http://people.ubuntu.com/~doko/java/openjdk6-armel/ contains a file named Packages.gz, and inside that file, which might explain the error mentioned above.

    Anders

  16. Xerxes Rånby says:

    Anders: I have put the details on the Synology wiki for how to make OpenJDK6 work on Synology 107+:
    http://www.synology.com/wiki/index.php/Java_for_Marvell_mv5281_ARM-based_Synology_Products

    Cheers!
    Xerxes

  17. Anders Pallisgaard says:

    Xerxes: Thanks a lot! I have installed classpath and jamvm and have just run a successful Hello World on my Synology 107+

    Fantastic!

  18. stephanazs says:

    Interesting facts.I have bookmarked this site. stephanazs

  19. Red Hat Magazine | More how to get OpenJDK says:

    [...] These instructions cover installing OpenJDK 6 for Fedora 9 and EPEL 5, as well as IcedTea 7 for Fedora 8. IcedTea 7 provides the OpenJDK 7 development branch with IcedTea components to make it build under Fedora using entirely open source components. The package name remains the same in the repository, despite the trademark agreement allowing the OpenJDK mark to be used by Fedora, because it is considered too disruptive to rename it now. Possibly related posts: (automatically generated)How to get OpenJDK 6 for Red Hat Enterprise Linux 5 [...]