Java is popular programming language for different platforms and project. Java is actually a programming language standard. Sun provides Java programming language tools under the name of
Java Runtime Environment or
Java Development Kit or
JDK. There is alternative name
OpenJDK which is another Java implementation. In this tutorial we will learn how to install OpenJDK.
OpenJDK vs JDK
OpenJDK is as its name suggests open source, open innovation and open standards Java framework. OpenJDK is supported by Oracle too bu there is no dictate from Oracle for its direction. OpenJDK provides most of the commercial JDK but there may be some performance problems for minor cases.
Search OpenJDK Packages
We will use
apt-cachesearch commands to list available OpenJDK packages. We will use
headless search term .
$ apt search openjdk headless
As we can see that there is two major versions 8 and 11 provided by out official repositories. There is also JRE and JDK versions too.
Install OpenJDK For Ubuntu, Debian, Mint and Kali
We will use
apt-get command for these distributions. There are different versions of OpenJDK which is related with JDK. Lets list them
$ sudo apt install openjdk-11-jdk-headless -y
Install OpenJDK For Fedora, CentOS, Red Hat
We can use
dnf to get OpenJDK packages. We generally prefer
yum for CentOS and Red Hat
dnf for Fedora.
$ sudo yum install java-openjdk