Categories
Linux

Install Java jdk8 in Ubuntu 14.04 from .tar.gz archive files

Installing Java8 in Ubuntu manually unzipping .tar.gz archive. Unzip the archive file , then place it /opt directory in ubuntu & use the linux commands.

If you want to install JDK / JRE in Ubuntu 14.04 LTS version then just download the archive file jdk1.8.0_66.tar.gz. The file name will be of this type jdk1.8.0_66.tar.gz , after downloading you have to put it in /opt/ directory. Use the following steps to install java 8 manually in Ubuntu 14.04 LTS version from jdk1.8.0_66.tar.gz archive files.

 Step1) Know your Linux OS 32/64 bit version by this command

$ uname -m

Step2) Download the proper JDK version from the Oracle site.

Step3) Unzip it & then place it inside /opt/ directory, using the command in terminal window or by using GUI in desktop or where you download the archive. Then place the unzipped folder into /opt/ directory.

Unzip command to unzip the archive into directly  /opt/jdk/ directory

tar -zxf jdk1.8.0_66.tar.gz -C /opt/jdk

Here I have unzipped already in my desktop folder /home/diet/Desktop/jdk1.8.0_66/, so now I shall place (move) it from Desktop/jdk1.8.0_66/  to  /opt/jdk1.8.0_66/   directory.

To do that I am using the following command:

root@ubuntu1404lts-hpnotebook:/home/diet/Desktop# mv   jdk1.8.0_66/    /opt/

Step4) Set this installation as default JDK , JAVA , JAVAC , JAR etc by the following commands

$ update-alternatives –install   /usr/bin/java   java    /opt/jdk1.8.0_66/bin/java   1072

$ update-alternatives –install   /usr/bin/javac  javac    /opt/jdk1.8.0_66/bin/javac   1072

$ update-alternatives –install   /usr/bin/jar   jar    /opt/jdk1.8.0_66/bin/jar   1072

Step5) Then verify your installation by the following command

update-alternatives --display java
update-alternatives --display javac
update-alternatives --display jar

Here is an excellent tutorial on it: