Installing oracle java on Linux with latest tar file

suggest change

Follow these steps to install Oracle JDK 8 update 112 from its tar archive. A later 8 update uses the same steps with that update’s file and directory names.

  1. Download the 8u112 tar file from here.
  2. You need sudo privileges:
sudo su
  1. Create a dir for jdk install:
mkdir /opt/jdk
  1. Extract downloaded tar into it:
tar -zxf jdk-8u112-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_112/bin/java 100

and

update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_112/bin/javac 100
  1. Check Java version:
java -version

Expected output:

The first line reports the update that was installed:

java version "1.8.0_112"

The remaining lines name the runtime build and the HotSpot VM. The exact build number depends on the downloaded archive.

Feedback about page:

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



Table Of Contents