In this post we will find out how to install the official Oracle Java JDK on Linux.
First, you need to download the correct package for your operating system.
Go here and download the Linux .tar.gz file for x86 or x64 platform.
At the time of writing this article, the current available version is Java SE Development Kit 8u74.
Now, copy the file you just downloaded to the folder /usr/local/java by doing
Now unpack the archive using this command
Wait for the extraction to be completed, then remove the .tar.gz archive.
Now, to let the JDK folder be system-wide available, we need to add it to the PATH. To do this, let’s run this command
and at the end of the file past these lines
where DIR_NAME is the name of the directory which was created when you extracted the .tar.gz archive.
Now let’s reload our changes by running
and it’s done!
If everything went out correctly you should be able to run
and see your current installed Java version!