Installing oracle java on Linux with latest tar file

suggest change

Follow the below steps to install Oracle JDK from the latest tar file:

  1. Download the latest tar file from here - Current latest is Java SE Development Kit 8u112.
  2. You need sudo privilages:
sudo su
  1. Create a dir for jdk install:
mkdir /opt/jdk
  1. Extract downloaded tar into it:
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
  1. Verify if the files are extracted:
ls /opt/jdk
  1. Setting Oracle JDK as the default JVM:
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
  1. Check Java version:

java -version

Expected output:

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents