Oracle Java JDK on Ubuntu

Installing Oracle JDK tar file on Ubuntu

1. Downloading Oracle Java JDK tar file:
$ wget –header “Cookie: oraclelicense=accept-securebackup-cookie”

2. Became a superuser:
$ sudo su

3. Create the jdk directory and extract:
# mkdir /opt/jdk
# tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

4. Verify the directory:
# ls /opt/jdk

5. Setting Oracle JDK as the default JVM:
For java:

# update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 1000

and for javac:

# update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 1000

6. Verify the installation:
# update-alternatives –display java
# update-alternatives –display javac

7. Setup JAVA_HOME:
Edit /etc/environment
and add

Source the updated environment:
$ source /etc/environment

Installing Oracle JDK using Webupd8team Repo:

1. Update Ubuntu:
# apt-get update && apt-get upgrade
# apt-get install software-properties-common

2. Add the Java repository:
# add-apt-repository ppa:webupd8team/java
# apt-get update

3. Install Java:
# apt-get install oracle-java9-installer

For older version:
# apt-get install oracle-java8-installer

Published by

Ferdy Mañago

/* Great Software Ideas */