Previous Page
PCLinuxOS Magazine
Article List
Next Page

How To Make OpenJDK Work On PClinuxOS

by Agent Smith (Alessandro Ebersol)

OpenJDK Tux

OpenJDK (Open Java Development Kit) is a free, open source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort that Sun Microsystems started in 2006. The implementation is licensed under the GPL-2.0, with only one linking exception. If it weren't for the GPL linking exception, components linked to the Java Class Library would be subject to the terms of the GPL license. OpenJDK has been the official reference implementation of Java SE since version 7.

OpenJDK components

The OpenJDK project has several components: the most important are the virtual machine (HotSpot), the Java class library and the Java compiler (javac).


The web browser plug-in and Web Start, which are part of Oracle Java, are not included in OpenJDK. Sun previously indicated that it would try to open source these components, but neither Sun nor Oracle have done so. The only free implementations of the plugin and Web Start currently available are those provided by IcedTea.

OpenJDK 9+ supports AOT compilation (jaotc) using GraalVM (JEP 295). The experimental -XX:+EnableJVMCIProduct flag allows the use of Graal JIT (JEP 317).

The development of OpenJDK

OpenJDK was initially based only on the JDK 7 version of the Java platform.

Since JDK 10, the effort to produce an open source reference implementation of the Java SE platform has been transferred to the JDK Project. Unlike the previous JDK Release Projects, which produced only one feature release and were then shut down, this long-running project will produce all future JDK feature releases and ship one feature release every six months, according to a strict time-based model.


JDK builds

Basically, there is only one set of source code for the JDK. It is hosted on Mercurial, at

Anyone can take the source code, produce a build and publish it. For this reason, Oracle has created a certification process that must be used to ensure that the build is valid.

This certification is carried out by the Java Community Process, which provides a Technology Compatibility Kit (TCK or JCK as in Java). If an organization produces an OpenJDK build that passes the TCK, that build can be described as “Java SE compatible”.

Some of the most popular OpenJDK builds in existence:

• Oracle OpenJDK
• RedHat Open JDK
• Azul Zulu
• AdoptOpenJDK
• Amazon Corretto
• Eclipse Temurin
• IBM Java SDK
• Microsoft Build of OpenJDK
• Alibaba Dragonwell

Why use OpenJDK?

Well, since Oracle's Java license changed in 2019, using OpenJDK, which uses the GPL2.0 license, is the safest move. Also, some programs were made for older versions of Java, so being able to use other versions of OpenJDK is extremely advantageous.

And, how to use OpenJDK on PCLinuxOS?

Well, it is possible to use OpenJDK on PCLinuxOS, and even better, it is possible to use more than one version of OpenJDK concurrently on your system.

How to do it? It's not difficult, just create two scripts and download a version of OpenJDK from the official website

OpenJDK Archive

On the site, choose the version you need and download the pre-compiled tar.gz files.

OpenJDK Download

I chose version 11.0.1

In /opt, I created the openjdk folder.

OpenJDK Download

And, inside the openjdk folder, I extracted the files I downloaded, openjdk-11.0.1_linux-x64_bin.tar.gz

In this case, the jdk-11.0.1 folder was created.

Well, now we have to create the launchers to call OpenJDK Java and Javac, if you want to compile your Java sources.

To run a .jar file, I created the script (openjdk11) below:

/opt/openjdk/jdk-11.0.1/bin/java $1 $2
And to compile a jar file, I created the script (openjdk11c) below:

/opt/openjdk/jdk-11.0.1/bin/javac $1 $2
These two scripts must be placed in /usr/bin and must have the execute attribute (chmod +x)

Then, to run a Java program, you must type

openjdk11 -jar program_name.jar

To compile your sources into jar code, type

openjdk11c [options] [sourcefiles]


There are some programs that only work with specific versions of Java. In my case, the income tax return program, from Brazil's government, only works with Java 11, and because of this, I had to find a way to run OpenJDK and fulfill my tasks with my country's tax authorities.

One of the advantages is that you can use OpenJDK side by side with Oracle's Java, or, you can have several versions of OpenJDK installed on your system, and, thanks to the launchers in /usr/bin, you can use them together.

I hope you enjoyed this tip. Best regards and see you next time.

Previous Page              Top              Next Page