Install Oracle JDK 8 under Linux in couple minutes

We were waiting for Java 8 so long, and finally it's ready with all its ground-breaking new features.

This article will help you to install or update Oracle JDK 8 under Linux. I've tested it with several Linux distributions including Debian Wheezy, Jessie, Ubuntu 12.04, 13.10, 14.04, CentOS 6.4, Mint 16 and Fedora 20.

To make installation as easy for you as possible I wrote JDK installation script. But since Oracle requires you to accept license before downloading binaries, installation consists of 2 steps:

  1. Download JDK as tar.gz file from Oracle's website.
  2. In terminal go to the directory with downloaded tar.gz file, and execute the following commands as sudoer:

    wget -O
    sudo bash

Let me bring some light to this mysterious command explaining what is gonna happen. The command will download and run my installation script which scans current directory for JDK tarballs and selects the latest one (based on name). After that it extracts tarball, updates environment variables and updates alternatives. The cool thing is if you already have JDK installed from repository, it will not override JDK installed by script. So you shouldn't be afraid to install packages from repository that have dependencies to OpenJDK.

Be aware that terminal sessions opened before installation still might show old version of java. If it's so, try to open a new terminal.

Among the last lines of this command's output you should see something like

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

If so, congratulations! Oracle JDK 8 has been successfully installed and you can enjoy cool features of new JDK release.

Tagged as : Java Linux