How to Install OpenJDK JAVA 11/8 on Ubuntu?

You can follow this tutorial to install JAVA OpenJDK in all the Ubuntu versions. Following are the steps to install OpenJDK JAVA on Ubuntu.

  1. OpenJDK Packages can available under native apt repository. Below command will find the available java version for Ubuntu OS.

    # apt-cache search openjdk
    

          Here, OpenJDK JAVA 11 should be present within the list.

  1. Hit below command. This will install Java Development Kit (JDK) and Java Runtime Environment (JRE).

    # sudo apt-get install openjdk-11-jre openjdk-11-jdk
    
  2. Verify the Java version using the below command.

    # java -version
    

    Output :

    openjdk version "11.0.6" 2020-01-14
    OpenJDK Runtime Environment (build 11.0.6+10-post-ubuntu-1ubuntu118.04.1)
    OpenJDK 64-Bit Server(build 11.0.6+10-post-ubuntu-1ubuntu118.04.1, mixed mode, sharing)
    


  3. Now, set the Java environment variable. To do that add the below line to /etc/environment.

    # echo "JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/" >> /etc/environment
    # source /etc/environment
    
  4. Finally, verify the environment value.

    # echo $JAVA_HOME
    

    Output :

    /usr/lib/jvm/java-11-openjdk-amd64/
    

     This is it. We are done with the installation of OpenJDK JAVA 11 on Ubuntu.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to install Magento 2.x.x in cPanel?

System Requirement :   Operating System: Centos, Debian, Ubuntu, RHCE RAM: 2 GB (Require for...

How to Prevent File/Directory Modification, Deletion and Renaming in Linux?

If you are looking to prevent any file from being modified, delete or renaming, you will need to...

Virtual Machine with CentOS 5 32-Bit OS Does not Address Physical Memory More Than 3 GB

Recently we came across very strange issue wherein Linux virtual machine with Centos 5.X 32 Bit...

How to change the MySQL timeout limit in Linux?

Please refer to the following article to change the MySQL timeout error.  Log in to your...

How to use chmod to change file permission?

In this article, we will describe how to use the chmod command to modify file permission in Linux...