When Sun’s (now Oracle’s) Java implementation was released as Free Software in 2006/7, starting the OpenJDK project, it already had over ten years of proprietary software development behind it. As a result, its codebase and build system are littered with assumptions and defaults designed for producing a binary blob that works on as many systems as possible. This is a very different design impetus from that of software which is developed in the open from the start, and the IcedTea project started as a way to adapt OpenJDK to this new world, and this remains one of its roles today.

Oracle still don’t provide binaries built solely from the OpenJDK codebase. Instead, their builds are based on a combination of the OpenJDK trees and their own internal proprietary trees. These have the same requirements as before, in depending on as little as possible being present on the target system. To achieve this on a GNU/Linux system, the C++ library is incorporated into the JDK binaries rather than being linked against, and the source trees include their own copies of the compression library, zlib, and imaging libraries (libjpeg, giflib, libpng, LCMS) which are then built as part of the JDK. This means that the binary will work on the target system without these libraries being present or in the required versions. For things that aren’t essential to the JDK, but provide optional extra features, the JDK will try to open the library at runtime and fail (usually silently) if it can’t be found. Examples of this include the Gtk+ look and feel and various system calls for the new NIO2 libraries in 1.7.

Such binary packages are the norm on Windows, Mac and mobile platforms, as is bringing everything you need with you. However, traditionally, GNU/Linux systems have a notion of distributions, which exist between the individual packages and the end user. You can think of choosing a GNU/Linux distribution as analogous to choosing which store you buy your groceries from. The same staples of the Linux kernel and a C library are provided by all distributions, in the same way all grocery stores stock bread and milk, but they distinguish themselves by how they package their products, what branding they apply and, as you reach more optional components, what software is included. Distributions like Fedora and Gentoo try to bring new versions of packages to their users as soon as possible, whereas others like Debian and Red Hat Enterprise Linux (RHEL) cater to those who want a more stable environment.

Access to these packages is through the package manager, which far predates the store concept that is coming of age on Windows, Mac and mobile platforms, and differs from these in that the software is usually available gratis. In including a package like OpenJDK in the package manager, distributions have very different aims to those described above. Critically, they know what packages are available and in what versions (i.e. the others provided by the package manager), so there is no need for the OpenJDK package to bundle its own copies. In fact, doing so creates problems as it increases the footprint of OpenJDK and, most importantly, prevents it from picking up on security updates made to the system copies of these libraries. For this reason, it is against the rules of a number of distributions to perform such bundling.

Since its inception, IcedTea has fixed the most problematic issues by building against the system C++, compression and imaging libraries. More recently, the IcedTea build even deletes the in-tree copies of these libraries to ensure the system version is being used. Thus, if a library like libjpeg is patched due to a security issue, the OpenJDK package will immediately benefit without having to be patched and re-built itself. With IcedTea 2.x, we went further and addressed the optional cases, where the JDK probes for libraries at runtime. In the IcedTea 2.x forests, support is provided to instead compile against these libraries. This ensures both that the code still works against the system installation of the library, and introduces a link between the JDK library and the system library which automated dependency tools can then detect.

Just this week, we’ve introduced support for compile-time building with the libpcsclite library. While this is primarily for testing (as the library needs to be interchangeable at run-time), it does mean that some basic checking of this code can be done by the compiler in development builds.

The result of all this is that someone new to IcedTea may think that it has many more dependencies than OpenJDK. However, most of these dependencies are taken from the OpenJDK codebase and are just not explicit when building it independently. Although this means it’s slightly harder to complete an IcedTea build, by the time you’ve done so, you know that all the libraries the JDK may need are present and have been compiled against, which gives a greater guarantee of runtime success than if, for example, you wait until someone fires up a graphical application using the Gtk+ look and feel and it fails. With the latest 1.13.0 release, all these options are now configurable on both 6 & 7, so you are free to make your own choices as to whether to go with a bundled or linked solution on a per-library basis.

Estanislao Bosch

As far as I remember Java was always free, maybe you mean open source

http://fuseyism.com/ Andii

No; please follow the link if you’re unfamiliar with the term used. Sun’s JDK was always available as gratis binaries. It wasn’t Free (as in Freedom) until 2006/7.

bondolo

The approach embed dependencies in OracleJDK and OpenJDK builds builds isn’t a consequence of either the pre-GPL history or that OracleJDK builds incorporate proprietary code.

It’s instead intentional inclusion to reduce external dependencies and also to ensure specific tested versions of libraries are used.

In some cases the Oracle builds have been relaxing which libs are embedded and which are linked at runtime from the host OS. Some of this is strictly a consequence of specific libraries becoming more commonly installed (and more reliable versions of them being installed). For example, XCB early on was not commonly available and due to local configuration issues the system installed version was not always reliable. The set of embedded libraries in OracleJDK builds will probably continue to change over time but will probably always embedd some libraries and certainly any proprietary libraries.

The IcedTea enhancement to allow for system libs to be used rather than embedded libs is excellent work. It’s definitely nice to have the option to use the system lib.

Yes, it is intentional “to reduce external dependencies and also to ensure specific tested versions of libraries are used”. But why? Because the end product is a binary. If the project had been developed as a FOSS project from the start, the primary output would be the source code, which results in different choices in designing the code & build system.

Yes, we’ve seen changes in the dependencies just between 6 & 7. There don’t seem to be any new ones with 8. As I say in the article, the whole problem just magically goes away if you’re packaging for a distribution where you know exactly what’s available (not just software, but the versions too).

I don’t think the situation with the binaries will change either, but I used that phrasing to subtly imply that I don’t agree with that situation (i.e. room for improvement there…). Oracle are happy to toot OpenJDK when it suits them, but they won’t rely on it to provide the end product.