Enable javascript in your browser for better experience. Need to know to enable it? Go here.
Blogs Banner

Go 12.4 and OpenJDK

Go historically only supported Oracle (formerly Sun) Java 6 – specifically Oracle JDK 6.

Oracle announced the retirement of the “Operating System Distributor License for Java” (DLJ), the license that allowed Linux distributors to package and redistribute Oracle’s Java versions in their respective Linux distributions.

The biggest impact of this is that automating the installation of Java on Linux systems is now a pain. Oracle Java now must be manually downloaded and installed and for Go users this means doing it for every system where a Go server or a Go agent are installed.

Over the last couple of years though OpenJDK has steadily matured and increased in popularity and it is now the preferred package for most Linux distributions.

For Go 12.4 we’ve worked on removing the dependency on Oracle 6 JDK and we’ve also used this opportunity to make the changes required to make Go work with the JRE, rather than JDK.  

We experienced some interesting installer challenges during this release since, apart from standard zip/gz installer files, we provide specific installers packages for specific systems, namely DEB, RPM, exe and Mac App. The primary purpose of these installer packages is to seamlessly integrate with the standard installation procedures expected by users of the respective Operating Systems.

When Go used to work only with Sun/Oracle JDK 6 it was simple to build installers with dependency checks for that specific package but supporting both Sun/Oracle and Open JDK exposed us to the nuances of the various packaging systems.

For example Debian has the java6-runtime virtual package that encapsulates this requirement very well: all the latest releases of Java on Debian add themselves as providers to this virtual package and this in turn makes the Go installation requirement clear in the DEB installer.

RPM packages don't have a common virtual package which includes both JRE and JDK. The situation is further complicated by the inability to specify an “OR” dependency in the RPM Spec and an “OR” dependency is required to specify that Go works with either the JRE or the JDK.

For these reasons the RPM installer doesn’t contain the dependency check and we found the experience to be better without it since it doesn’t force the user with a JDK already installed to also install the JRE or vice-versa.

We found out that it’s better to notify the users if Java is not found during the server startup rather than force them to get both JRE and JDK on the same system owing to a dependency check in the installer.

On Mac OS X the installer has a dependency check recorded in the info.plist to indicate that Go needs JRE 6 or above. This requirement specification works well with the JRE provided by Apple but not with a custom installation of Open JDK. In general it looks like Mac users prefer to use the Apple JRE and it’s also the only way to support versions from Snow Leopard to Mountain Lion.

Last but not least the Windows installer now allows users to specify their Java location, in case they have a version already installed, or choose the Oracle JRE 7 which comes packaged with Go for Windows.

We currently do not support IBM Java on any platform. 

See how the newly-released (and much-enhanced) Go 12.4 can help optimize your CD process 

Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.

Keep up to date with our latest insights