OpenJDK vs Oracle JDK and install for Debian based Linux Systems

Windows Articles

Ubuntu Rolling Release? It is possible with Rolling Rhino

Throughout the Linux community, there are always expectations about when Ubuntu decides to have a Rolling Release. This, at least, since the...

How to recover files deleted with Windows File Recovery

Hello! Deleting files by accident is one of the biggest fears of users. Indeed, unintentionally deleting documents, music or photos can be...

How to install Vivaldi Web Browser on Ubuntu 20.04 / 19.10?

This is a short post in which I will show you how to install Vivaldi Web Browser on Ubuntu 20.04 / 19.10...

Linuxfx is a Windows 10 clone based on Ubuntu.

Hi! Most Windows users are afraid to switch to Linux for various reasons. However, the biggest one is the difference in the...

How to install OpenMeetings on Ubuntu 20.04 / 18.04?

If there is one thing the Internet has completely revolutionized, it is long-distance communications. And with it the business meetings that thanks to many...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

Both OpenJDK and Oracle JDK are created and maintained currently by Oracle only.

OpenJDK and Oracle JDK are implementations of the same Java specification passed the TCK (Java Technology Certification Kit).

Most of the vendors of JDK are written on top of OpenJDK by doing a few tweaks to [mostly to replace licensed proprietary parts / replace with more high-performance items that only work on specific OS] components without breaking the TCK compatibility.

Many vendors implemented the Java specification and got TCK passed. For example, IBM J9, Azul Zulu, Azul Zing, and Oracle JDK.

Almost every existing JDK is derived from OpenJDK.

As suggested by many, licensing is a change between JDKs.

Starting with JDK 11 accessing the long time support Oracle JDK/Java SE will now require a commercial license. You should now pay attention to which JDK you’re installing as Oracle JDK without subscription could stop working.

How to install java11 on Debian9 /mint 19/ Ubuntu 18 ?

A-Install OpenJDK  from the the standard repository

With this easy command you can install  openjdk  in all  above systems

sudo apt install default-jdk
root@osradar:~# java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
root@osradar:~#

B-Install JDK from Oralce 

From your Terminal console

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_linux-x64_bin.deb

B1- Install Deb  file

 dpkg -i jdk-11.0.1_linux-x64_bin.deb

B2-configure Java 11 as the default version on your system.

root@osradar:~# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.1/bin/java 2
root@osradar:~# update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-10-oracle/bin/java 1091 auto mode
1 /usr/bin/gij-6 1060 manual mode
* 2 /usr/lib/jvm/java-10-oracle/bin/java 1091 manual mode
3 /usr/lib/jvm/jdk-11.0.1/bin/java 2 manual mode

Press <enter> to keep the current choice[*], or type selection number: 3

The version 11 has been slected now.

There are some other binaries  like  jar  and javac to set as default for JDK installation with  the bellow commands

root@osradar:~# update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-11.0.1/bin/jar 2
root@osradar:~# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-11.0.1/bin/javac 2
root@osradar:~# update-alternatives --set jar /usr/lib/jvm/jdk-11.0.1/bin/jar
root@osradar:~# update-alternatives --set javac /usr/lib/jvm/jdk-11.0.1/bin/javac
root@osradar:~#

C-1-Check now Your  Java version

root@osradar:~# java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
root@osradar:~#

C-2-Set Environment variables for Java applications

Vi /etc/profile.d/jdk11.sh

export J2SDKDIR=/usr/lib/jvm/java-11.0.1
export J2REDIR=/usr/lib/jvm/java-11.0.1
export PATH=$PATH:/usr/lib/jvm/java-11.0.1/bin:/usr/lib/jvm/java-11.0.1/db/bin
export JAVA_HOME=/usr/lib/jvm/java-11.0.1
export DERBY_HOME=/usr/lib/jvm/java-11.0.1/db

C-3-Load the settings  without a reboot

source /etc/profile.d/jdk11.sh
root@osradar:~# java --version
java 11.0.1 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
root@osradar:~# jar --version
jar 11.0.1
root@osradar:~# javac --version
javac 11.0.1
root@osradar:~#

Please Enjoy and share

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Ubuntu Rolling Release? It is possible with Rolling Rhino

Throughout the Linux community, there are always expectations about when Ubuntu decides to have a Rolling Release. This, at least, since the...

How to recover files deleted with Windows File Recovery

Hello! Deleting files by accident is one of the biggest fears of users. Indeed, unintentionally deleting documents, music or photos can be...

How to install Vivaldi Web Browser on Ubuntu 20.04 / 19.10?

This is a short post in which I will show you how to install Vivaldi Web Browser on Ubuntu 20.04 / 19.10...

Linuxfx is a Windows 10 clone based on Ubuntu.

Hi! Most Windows users are afraid to switch to Linux for various reasons. However, the biggest one is the difference in the...

How to install OpenMeetings on Ubuntu 20.04 / 18.04?

If there is one thing the Internet has completely revolutionized, it is long-distance communications. And with it the business meetings that thanks to many...