Linux — Installation of Oracle Jave JDK/JRE

  1.  check OS archi­tec­ture: 32-bit or 64-bit?

    file /lib/systemd/systemd

  2. check if we have Java installed on our OS

    java –ver­sion

    if we should unin­stall Open­JDK if we have one installed on our OS.

    sudo apt-get purge open­jdk-\*

  3. cre­ate a direc­to­ry to hold our Ora­cle Java JDK bina­ries.

    sudo mkdir –p /usr/local/oracle-java

  4. Down­load Ora­cle Java JDK for lin­ux
    link:http://www.oracle.com/technetwork/java/javase/downloads/index.html
  5. copy the file we down­load to the direc­to­ry we cre­ate

    sudo cp –r jdk-8u20-linux-i586.tar.gz /usr/local/oracle-java/
    cd /usr/local/oracle-java/

  6. unpack the com­pressed file we down­load

    sudo tar xvzf jdk-8u91-linux-x64.tar.gz

  7. Edit the sys­tem PATH file /etc/profile and add the fol­low­ing sys­tem vari­ables to your sys­tem path.

    sudo vim /etc/profile

    then add the fol­low­ing lines below to the end of the file pro­file (final­ly save and exit):

    JAVA_HOME=/usr/local/oracle-java/jdk1.8.0_91
    PATH=$PATH:$JAVA_HOME/bin
    export JAVA_HOME
    export PATH

  8. Inform our OS where our Ora­cle Java JDK is locat­ed.

    sudo update-alter­na­tives –install “/usr/bin/java” “java” “/usr/local/oracle-java/jdk1.8.0_91/bin/java” 1
    sudo update-alter­na­tives –install “/usr/bin/javac” “javac” “/usr/local/oracle-java/jdk1.8.0_91/bin/javac” 1
    sudo update-alter­na­tives –install “/usr/bin/javaws” “javaws” “/usr/local/oracle-java/jdk1.8.0_91/bin/javaws” 1

  9. Inform our OS that Ora­cle Java JDK must be the default Java.

    sudo update-alter­na­tives –set java /usr/local/oracle-java/jdk1.8.0_91/bin/java
    sudo update-alter­na­tives –set javac /usr/local/oracle-java/jdk1.8.0_91/bin/javac
    sudo update-alter­na­tives –set javaws /usr/local/oracle-java/jdk1.8.0_91/bin/javaws

  10. Reload our sys­tem wide PATH /etc/profile

    source /etc/profile

  11. test if we hava Java installed

    java –ver­sion
    javac –ver­sion

  12. Suc­cess­ful­ly!

Leave a Reply

Your email address will not be published. Required fields are marked *