TecAdmin
    Menu
    • Home
    • Ubuntu 18.04
      • Whats New?
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install Git
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • Funny Tools
    • FeedBack
    • Submit Article
    • About Us

    How to Install JAVA 8 on Ubuntu 18.04/16.04, Linux Mint 19/18

    Written by Rahul
    JAVA install java on ubuntu, java, jdk, jre, linuxmint, ppa, Ubuntu

    There are two standard types of installation available are JDK and JRE. JDK (Java Development Kit) provides the ability to develop a new Java application, which includes Java compiler. JRE (Java Runtime Environment) provides the runtime environment for any Java application with applets. The Java developers required to install JDK and JRE both on their system to create new Java Applications.

    IMPORTANT: The Oracle Java 8 is no longer available to download publically. You can use below link to install Java 11. You may also continue to this tutorial to install OpenJDK 8.

    • Read this => Install Oracle Java 11 on Ubuntu 16.04 LTS (Xenial)
    • Read this => Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic)

    Use this tutorial to install OpenJDK Java 8 on Ubuntu 19.10, 18.04 LTS, 16.04 LTS, LinuxMint 19, 18 using PPA. Follow the below steps to install Java 8 on Ubuntu via the command line.

    Step 1 – Install Java 8 on Ubuntu

    The OpenJDK 8 is available under default Apt repositories. You can simply install Java 8 on an Ubuntu system using the following commands.

    Run below commands to install Java 8 on Ubuntu and LinuxMint.

    sudo apt update
    sudo apt install openjdk-8-jdk openjdk-8-jre
    

    Step 2 – Verify Java Inatallation

    After successfully installing Oracle Java 8 using the above steps, Let’s verify the installed version using the following command.

    java -version
    
    openjdk version "1.8.0_222"
    OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
    OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
    

    Step 3 – Setup JAVA_HOME and JRE_HOME Variable

    After installing Java on Linux system, You must have to set JAVA_HOME and JRE_HOME environment variables, which is used by many Java applications to find Java libraries during runtime. You can set these variables in /etc/environment file using the following command.

    cat >> /etc/environment <<EOL
    JAVA_HOME= /usr/lib/jvm/java-8-openjdk-amd64
    JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
    EOL
    

    All done, you have successfully installed Java 8 on a Linux system. You may also need to install Tomcat server to run your Java web application. Use our another tutorial to Install Tomcat 7 or Install Tomcat 8 or Install Tomcat 9 on Ubuntu, Debian, and LinuxMint systems.

    Share it!
    Share on Facebook
    Share on Twitter
    Share on Reddit
    Share on Tumblr
    Rahul
    Rahul
    Connect on Facebook Connect on Twitter

    I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

    Related Posts

    • How to Install Java 11/8 on Fedora 30/29/28

      October 6, 2019
    • How to Install Java 11/8 on Amazon Linux

      October 5, 2019
    • How to Install Java on CentOS 8

      September 18, 2019
    • How to Get Current Date and Time in Java

      April 7, 2019
    • How To Install Java on Debian 10 (Buster)

      March 20, 2019

    171 Comments

    1. Avatar Sen Reply to Sen
      October 31, 2019 at 11:49 am

      This works perfectly as of 31-Oct-2019

    2. Avatar Ashish Reply to Ashish
      October 8, 2019 at 8:56 am

      Working perfectly

    3. Avatar Sathishkumar Reply to Sathishkumar
      September 5, 2019 at 7:07 am

      Hi, I’m using Ubuntu 18.04 and I’m getting below error :

      Package oracle-java8-installer is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source

      E: Package ‘oracle-java8-installer’ has no installation candidate

      • Avatar Alison Reply to Alison
        September 23, 2019 at 9:14 pm

        This article is out of date, and, as of September 2019, no longer works.

    4. Avatar Shivdas Kanade Reply to Shivdas
      August 2, 2019 at 9:33 am

      very easy steps. Thanks

    5. Avatar Edwin Smith Velandia Salazar Reply to Edwin
      June 6, 2019 at 4:05 pm

      work for me,

      sudo apt-get install default-jdk
      sudo apt autoremove
      sudo apt-get install default-jre
      java –version
      sudo apt install openjdk-8-jdk

      sudo update-alternatives –config java
      Existen 2 opciones para la alternativa java (que provee /usr/bin/java).

      Selección Ruta Prioridad Estado
      ————————————————————
      0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 modo automático
      1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 modo manual
      * 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 modo manual

      Pulse para mantener el valor por omisión [*] o pulse un número de selección:

      *** in my case, i used java-8, press 2

      and my app work.

      • Avatar Jonathan Reply to Jonathan
        October 21, 2019 at 5:11 pm

        worked on LinuxMint. Thanks

    6. Avatar Jignesh Reply to Jignesh
      May 31, 2019 at 4:39 pm

      It’s not working and it won’t work. You need to update your article. Oracle has made it mandatory to create an account and download the required version. The PPA method is deprecated and it won’t work.

      TIP: Make sure you download the binary version or the Oracle 8 JDK.

    « Previous 1 … 13 14 15

    Leave a Reply

    Cancel reply

    Popular Posts

    • How to Auto Renew Let’s Encrypt Certificates
    • How to Install and Use virtualenv with Python 3
    • How to Test TLS version used for PHP
    • How to Use TLS 1.2 with cURL PHP
    • How To Install mod_cloudflare for Apache on Ubuntu
    Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
    We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
    Revoke cookies