I just completly shifted to Ubuntu from Windows 7. I am a java developer and now I need to install Java 8 JDK and JRE. I installed 64 bit ubuntu 14.04.02 and it seems like there are lot of ways to install the Oracle Java JDK, but I am not understanding any of it properly (mostly because the tutorials are outdated!).

Now, the easiest way I found is in here -http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/

But I am not sure whether this is a good idea to install via a PPA because it is coming from a third party source.

I didn't monitor any step by step guide on askubuntu about installing the Java JDK 8. Can someone help me with that please? Just installing is not enough, setting up the environment variables also mandatory.

Anyway, if the PPA is the recommended best way, please let me know that too.


I have been using that webupd8 PPA for a long time, and it has always worked fine for me.

Look at this similar question/answer

For your general question about PPAs... Using PPAs is a fact of life for many 3rd party software apps in Ubuntu. There is nothing inheritely wrong/bad with it at all. Of course, it's always best to stick with the supported archives, but sometimes you can't, and I find PPAs are much saner than a bunch of randomly downloaded software.

Especially for a recent switcher to Ubuntu, I think the experience is much nicer with PPAs.

| improve this answer | |

Actually all these PPAs are from third parties. Oracle does not provide any PPA, and the manual way of installing Oracle JDK 8 is explained in step by step manner in this article : Install Latest Oracle JDK in Ubuntu

Step 1: Download the latest JDK(jdk-Xuxx-linux-xXX.tar.gz) from this official link.

Step 2: Open the terminal (Ctrl + Alt + T) and enter the following command.

sudo mkdir /usr/lib/jvm

Step 3: Enter the following command to change the directory.

cd /usr/lib/jvm

Step 4: Extract the jdk-Xuxx-linux-xXX.tar.gz file in that directory using this command.

sudo tar -xvzf ~/Downloads/jdk-8u45-linux-x64.tar.gz

Step 5: Enter the following command to open the environment variables file.

sudo -H gedit /etc/environment

Step 6: In the opened file, add the following bin folders to the existing PATH variable.


The PATH variables have to be separated by colon. Notice that the installed JDK version is 1.8 update 45. Depending on your JDK version, the paths can be different. Add the following environment variables at the end of the file.


The environment file before the modification:


The environment file after the modification:

| improve this answer | |

It isn't PPAs that are unsafe, it is the stuff inside that can make them unsafe (more here). I use the PPA you linked to run Oracle Java myself, rather than install it every new update, and it is a reputable source for many people. If you want the easy, and in this case, safe way, feel free to follow the guide you linked to add the PPA, otherwise follow the link dpb said in his answer to install it yourself.

Now, for the environment variables. Most programs that run natively on linux with java in mind can find its location, but if you really want to set the variables, just use this:

echo 'variable_to_set=what_to_set_it_to' >> .bashrc 

What this does is it adds a new line to your .bashrc (run every time you use the terminal) and sets the variable variable_to_set to what_to_set_it_to every time you use the terminal.

You can see that it worked by doing this in a new terminal:

echo "$variable_to_set" 

The output should be what_to_set_it_to if it works. For Java, you may want to set JAVA_HOME, or any other variable you want.

Hope this helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.