As I mentioned in an earlier post, officially supported OpenJDK builds for non-Linux platforms have been notoriously hard to come by in the past, at least until Azul started their Zulu builds in 2013. Unofficial community builds are also available from the ojdkbuild project on Github.
Today Redhat announced that their OpenJDK offerings now include builds for the Windows platform as well.
After Google decided to use OpenJDK in Android N, I guess this is another strong indicator of OpenJDK’s value and increasingly wide adoption.
So how does this fit together?
But source code needs to be compiled into executable binaries to be useful for end users. And that’s where things get dicey …
Where to find OpenJDK builds
For a long time there has been no reliable source for certified, well-supported builds of OpenJDK for all platforms.
The various GNU/Linux distributions, like Fedora, Debian, etc, have provided OpenJDK builds for a quite a while now, but for Windows and MacOS there were only some unofficial, often outdated hobby projects without reliable security updates.
Zulu – Open JDK builds
This changed within the last 2 years: JVM vendor Azul Systems first released their “Zulu” line of free OpenJDK builds in September 2013, mainly targeting Windows Servers and the Microsoft Azure cloud. In 2014 they added support for Linux, MacOS and Java 8, as well as Docker images. All Zulu builds are certified against the official Java SE TCK. The focus is on the JDK and servers, without browser plugin or webstart.
The Azul website does not clearly state their security update policy for their free builds, but they offer deb and rpm package repositories that seem to contain latest builds of OpenJDK that match the current Oracle JDK update versions. Also, their engineers participate in the community and allegedly contribute back to OpenJDK.
Zulu – OpenJDK 8 for Debian stable
For Debian stable (Wheezy or Jessie), Azul is a convenient way to install OpenJDK 8, since the Debian openjdk-8 package is currently only available in Debian unstable and hasn’t even made it into the Debian testing yet.
Here is how I set up the Azul deb repo and installed their OpenJDK 8:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9 apt_source='deb http://repos.azulsystems.com/debian stable main' apt_list='/etc/apt/sources.list.d/zulu.list' echo "$apt_source" | sudo tee "$apt_list" > /dev/null sudo apt-get update sudo apt-get install zulu-8
Please note, that the package installation automatically sets the Java related system alternatives to the Zulu ones. So right after zulu-8 installation the java version in your system path will be something like this:
oliver@basement:~$ java -version openjdk version "1.8.0_45" OpenJDK Runtime Environment (Zulu 184.108.40.206-linux64) (build 1.8.0_45-b14) OpenJDK 64-Bit Server VM (Zulu 220.127.116.11-linux64) (build 25.45-b02, mixed mode)
Recently, I came across a question whether Object.wait() uses an “infinite loop”.
I didn’t know the answer, but since the JDK is Open Source, I thought I could at least find out where the code is and look at it.
So for example for JDK 7, these are the steps through the OpenJDK sources:
- In Object.java wait() calls the native method wait(timeout) via wait(0)
- The native code for wait in Object.c actually uses JVM_MonitorWait.
- The JVM wrapper method JVM_MonitorWait calls ObjectSynchronizer::wait.
- ObjectSynchronizer::wait calls wait() on an ObjectMonitor.
- Finally ObjectMonitor::wait does the real work.
I don’t fully understand that code, but I certainly don’t see an infinite loop in there. :o)