install specific java version for 12.04

If you need install specific version of Java on any distro, you must do it manually, but it is easy.

First you need which architecture OS you have.

uname -a

The x86_64 is 64bit and ix86 (x can be 3 or 6).

If you have 64 bit OS (in present it is probably) follow this steps. -> Open the terminal.

1) Create directory and go to /opt/jdk

mkdir /opt/jdk
cd /opt

2) Download Java package (if someone need another version only need change version and build in link)

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz

3) Optional (if you are not logged as root you need):

sudo su

4) Untar the package:

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

5) Set Oracle's Java as default:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

6) Check Java version if it os ok

java -version

I follow this part of this tutorial, but this method is for anyone distro. For example I mainly used this for installation on servers where we nedd specific version of Java 7.

Tags:

Java

12.04