posts
What is OpenJDK
and why you should use it

What is OpenJDK and why you should use it

Feb 10, 2022
Dmitry Chuyko
19.2

OpenJDK is the development kit for Java, the language with 26 years of history behind it. It is not a new language by any standards, especially in the industry where new solutions appear every few years and are usually better than their predecessors. And OpenJDK, the most popular instance of Java, is 14 years old already. By all means, OpenJDK should have been replaced many times already. And yet it is still one of the most popular development tools in the world! How could this happen?

In this article we will try to answer this question, dive deep into the process of constant upgrading of OpenJDK, talk about open source approach to development, and describe all the things that make Java so unique.

What makes Java and OpenJDK special?

How OpenJDK came to be

The history of Java began in 1991, when engineers at Sun Microsystems became frustrated with the C and C++ programming languages’ restrictions and APIs. The prototype of the language was initially named “Oak”, later renamed to Java.

It first became available for download in 1994, with first public release in 1995, and almost immediately received support in the then popular Netscape web browser.

In 2006 Sun released the Java HotSpot virtual machine and compiler as free software under the GNU General Public License, and since then the history of OpenJDK started with Java 6 and 7 being open source. During the period from 2006 and 2008, more and more code was being opened.

Right now, OpenJDK’s code is available to anyone, and is developed by a large community situated around Oracle. There are many distributions of OpenJDK available, including Liberica JDK built by BellSoft, which is also freely available for anyone to explore and use in accordance with the open source approach.

How OpenJDK works and what are the advantages

There were several goals formed at the inception of Java, including:

  • Java is simple, object-oriented, and familiar.
  • Java is robust and secure.
  • Java language is architecture-neutral, and JVM is portable.
  • Java is able to execute with high performance.

And these principles are still what makes OpenJDK popular, so it is important to explore each of them and see how they affect the life of developers and end-users.

Java language is architecture-neutral and JVM is portable

Java code is architecture-neutral, meaning that if written right, it can be launched on any device, from PC to modern microwave. This is made possible by utilizing the most important feature of Java 一 JVM, Java Virtual Machine, runtime used for executing applications.

Usually most of the programming languages compile their code into machine code, that is different for any platform. Java compiler works differently, it creates the special “java bytecode”, that can be executed by Java Virtual Machine running on any system.

The JVM in turn uses a dynamic compiler that compiles code during the execution of the app.

This approach allows running the same code on completely different platforms with a little to none rewriting! That’s right, you can write the program once, then execute it anywhere, if you follow the guidelines. So if you ever wanted to play Tetris (or rule the world) using your modern microwave’s touch screen 一 Java is the easiest language to do it!

But in all seriousness, this approach, called “Write Once, Run Anywhere”, allows you to not have to deal with different architectures, OSes, drivers, or hardware. The only thing you need to do is to utilize the virtual machine for the chosen platform, and there are a lot of them supported, more in the works.

Java is simple, object-oriented, and familiar

These days, Java syntax is not the easiest anymore… at least for now, as there are many new features in the works that make the code easier to read and write. And yet, at the time of its conception it was much more organized than its competitors. The Java Language Specification is the set of rules that ensures that all the innovations follow the same logic and are created in accordance with Java ideology. All the APIs are created to be compatible with each other and Java specification, so it has everything you need to not only write your code effectively, but inspect and utilize other people’s work. New ways to program that implement new technologies, like pattern matching for switch and Vector API, are being constantly implemented.

Java is robust and secure

Being an open source project, OpenJDK’s code is available for anyone who wants to check or enhance its security. It means that newfound vulnerabilities are constantly being patched with quarterly CPU releases and in the case of Liberica JDK fixed by our support.

And with the wide selection of security tools like vulnerabilities scanners you can be sure that the attempts to breach the security of your apps and infrastructure will not succeed.

Java is high-performant

There are many ways to boost your OpenJDK apps. The compilers inside the JVM optimize the code for peak performance. If the startup time is more important, you can use GraalVM native image technology that packs the applications together with the runtime into a single executable binary file.

To find out why Java works best for your development contact our engineers.

How OpenJDK is being developed

OpenJDK as the base for a race into space

You can compare a programming language to the spaceport the spaceships are launched from. When developers build their applications, “the spaceships”, they expect the infrastructure to work and make their life easier. It means that every mistake in the functioning of the programming platform and runtime will put them into a dangerous situation, when they did everything right, but the launch failed, causing the waste of time and money.

So why do they choose OpenJDK? Because it is the “spaceport” managed by a reliable and large community.

Let’s find out how everything works in OpenJDK.

The process of upgrading the OpenJDK

The development of OpenJDK could be divided into several directions:

  • Bug fixing;
  • Implementation of new features and the deprecation of the outdated features;
  • The projects outside of the main branch.

Let’s discuss them all in-depth.

Bug fixing

Today, when GitHub is utilized for OpenJDK development, the process is mostly automated and considerably faster than it used to be.

To report a newfound bug, a developer uses the mail list to describe the error, which is then given a number..

When a developer wishes to fix a bug, they create a fork in the repository, which is basically a copy of the whole project. Then in this fork, the developer edits the necessary part of the code to fix the bug. After the successful testing, they make a pull request with the new code back into the main branch.

The code is then reviewed and, in case it is satisfactory, implemented into the main branch for the next release of OpenJDK.

That system allows any developer to try and fix any found bug.

Implementation of new features and deprecation of the outdated features

New features are usually implemented in a few steps.

First, it is proposed as a concept (draft) by developers. The member of the Governing Board called OpenJDK lead decides if the feature is worth working on.

After the approval, the draft is updated with the necessary description and the proposition of basic implementation, becoming the JEP (JDK Enhancement Proposal). It goes through many stages before completion.

The implementation process itself is similar to the bug fixing described earlier and is done via fork branches on GitHub. This process could take a long time to finish as the new functionality is released in stages. The Previews deal with semantics and syntax, the Incubators 一 with API changes. There could be as many as 3 previews or incubators before the final implementation of the feature is released. This is done to allow the developers to test the new functionality and see how well it works with the new code and the existing one, so as not to break the already working applications. Usually after 2 previews or incubators, the new code is either added to the release in final form or removed if deemed unsafe or underperforming.

The projects outside of the main branch.

Some projects that affect the functionality of Java greatly are developed outside of the main branch. If successful they drastically change the language, but they take a lot of time to be polished. They can be still implemented into OpenJDK in their current state if needed, and some developers routinely do this. In time they become JEPs and a part of the next release.

Changes to the specification

Specification upgrades are proposed and developed in the form of JSR 一 Java Specification Request. These go through the public review and vote by the Executive Committee consisting of companies and people guiding the evolution of Java technology. BellSoft is also a part of that committee along with companies such as Alibaba, Amazon, IBM, Intel, and Oracle.

The release cadence

There are three kinds or releases of OpenJDK:

  • Quarterly CPU release discussed earlier. It is built with security in mind and consists of vulnerability and bug fixes.
  • Technical release 一 a numbered release with new features, intended mostly for trying them out. It is useful for developers to test the new technologies, get their apps ready for deprecation of the old ones, and plan their future work.
  • LTS (Long Term Support) numbered releases. These are the ones full of tested implementations and will be supported by vendors for the longest time. They are meant to be the base to develop and run the programs in an enterprise environment.

Before Java 9 release in 2017, it could take up to almost 5 years for a new numbered release to come out. Since then, Oracle switched to the new release cadence with two numbered releases every year and a new LTS release every two years. With Java 17 being the latest LTS release, the next one will be Java 21 in September 2023, and the following ones will be released every two years.

The support itself is provided by many vendors, including BellSoft, with new versions of Liberica JDK released at the same time as other major distributions.

Why open source is better than closed source

It is important to remember that OpenJDK is an open source project. It matters, because all the closed source alternatives are essentially the black boxes. Could they be safer in theory? Yes. But also in theory, they could contain a large number of vulnerabilities no one knows of… or maybe no one but the data thieves who already use the bugs to steal money or information with developers none the wiser.

In open source, this is impossible. You always know what works, what does not, and why. Sure, the malicious actors can study the code, but a large number of developers and security managers also can! All the vulnerabilities are quickly discovered and fixed. All the ciphering algorithms and security measures are available for testing.

And one more thing 一 if you think you can do something better than it’s done 一 you can just go ahead and do it!

Which leads us to the next question.

Why are there so many OpenJDK vendors and implementations?

Outside of a raw OpenJDK, there are a lot of vendors who sell or provide for free their own builds, including BellSoft that makes Liberica JDK. Why are there so many to choose from and what are the differences?

The answer is simple 一 functionality, security and support. All the Java Development Kits, including Oracle Java SE, are based on OpenJDK. They all can run the Java code just the way it is intended to run, and they are similar when everything is working fine. The differences arise when something is wrong.

If you use the OpenJDK in enterprise and you face the problem, you need experts to deal with it. You either have to keep your own team dedicated to maintaining the stability of OpenJDK (which is costly and not always necessary) or contact the people who can help. In the case of OpenJDK, you need to go through all the channels described earlier to fix the bug or to get the answer and wait in line.

Now, the vendors are there to help their clients. Some of them do that efficiently and fast, some demand you first speak with the managers and lawyers, taking your time and making you lose money. We in BellSoft strive to provide you with high-powered support with a response time as fast as 1 hour and the extended support timeline for older Java versions, including 6 & 7.

Other advantages of OpenJDK builds like Liberica JDK are the additional security enhancements and functionality that make your applications even safer. Click the button below to get a comprehensive summary of Liberica JDK features.

Get white paper on Liberica JDK

Conclusion

OpenJDK is an amazing platform for app development and it only gets better with age!

We invite you to join the large developers community that utilize Java daily. Each of us works to make it better, and this is the best guarantee that Java will live on many years from now.

Subcribe to our newsletter

figure

Read the industry news, receive solutions to your problems, and find the ways to save money.

Further reading