Download and Install JAVA 8 on Linux Ubuntu. How to Install JAVA 8 (JDK 8u45) on Ubuntu 15.04, Ubuntu 14.04 and Ubuntu 14.10. The stable release of Java version is 1.8.0_45 i.e JDK 8u45.
Please note that many Linux distribution are shipped with OpenJDK, other version of Java. OpenJDK is not developed by Sun Microsystems, instead OpenJDK is an open source implementation of Java application.
Before you begin the installation, run the following command to verify the version of Java already installed on the system.
$ java -version
Now, Make a directory where you want to install Java. For access to all users, install Java in the /opt/java directory. Run the following commands to create the directory:
$ sudo mkdir /opt/java && cd /opt/java
Now run the following command to download Java installer files directly into the /opt/java directory:
For 32-bit Systems
$ cd /opt/java
$ sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-i586.tar.gz"
$ tar -zxvf jdk-8u45-linux-i586.tar.gz
For 64-bit Systems
$ cd /opt/java
$ sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
$ tar -zxvf jdk-8u45-linux-x64.tar.gz
Next, run the commands given below to tell system where java is installed:
$ cd jdk1.8.0_45/
$ update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_45/bin/java 100
$ update-alternatives --config java
Now Update Java Alternatives using the following command:
$ update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.8.0_45/bin/javac 100
$ update-alternatives --config javac
Again update the jar alternatives:
$ update-alternatives --install /usr/bin/jar jar /opt/java/jdk1.8.0_45/bin/jar 100
$ update-alternatives --config jar
Finally set the Java Environment Variables.
$ export JAVA_HOME=/opt/java/jdk1.8.0_45/
$ export JRE_HOME=/opt/java/jdk1.8.0._45/jre
$ export PATH=$PATH:/opt/java/jdk1.8.0_45/bin:/opt/java/jdk1.8.0_45/jre/bin
Now just to confirm, verify the Java version again (find command above).
Enable Java Support in Firefox
10. To enable Java 8 JDK 8u45 Support in Firefox, you need to run following commands to enable Java module for Firefox.
On Debian, Ubuntu and Mint
For 32-bit Systems
$ update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_45/jre/lib/i386/libnpjp2.so 20000
For 64-bit Systems
$ update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_45/jre/lib/amd64/libnpjp2.so 20000
On RHEL, CentOS and Fedora
For 32-bit Systems
$ alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_45/jre/lib/i386/libnpjp2.so 20000
For 64-bit Systems
$ alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /opt/java/jdk1.8.0_45/jre/lib/amd64/libnpjp2.so 20000
Now restart Firefox and enter about:plugins in the URL/address bar. You will get the following screen verifying the Java 8 JDK 8u45 Support in Firefox browser:
Image via http://www.tecmint.com/