HomeAbout MeContact Me
Install Oracle Java JDK on Linux
Linux
Install Oracle Java JDK on Linux
Emanuele Papa
Emanuele Papa
February 13, 2016
1 min

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

sudo cp -r FILE_NAME /usr/local/java/

Now unpack the archive using this command

sudo tar xvzf FILE_NAME

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

sudo gedit /etc/profile

and at the end of the file past these lines

JAVA_HOME=/usr/local/java/DIR_NAME
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH

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

source /etc/profile

and it’s done!

If everything went out correctly you should be able to run

java -version

and see your current installed Java version!

Happy development!


Tags

Share


Previous Article
Custom Fragment Backstack in Android
Emanuele Papa

Emanuele Papa

Android Developer

Related Posts

How to debug an Annotation Processor in Android Studio
How to debug an Annotation Processor in Android Studio
July 05, 2020
1 min

Quick Links

HomeAbout MeContact MeRSS Feed

Social Media