I was trying to get Java8 working on Ubuntu Trusty to install a Cassandra cluster.
I couldn’t immediately find a tutorial that worked out of the box on a minimal Ubuntu machine, so I thought I’d share what worked for me.
First, this looks good: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html, so I followed that.
Add PPA location
I ran into an error right away while trying to add the PPA location:
sudo: add-apt-repository: command not found
I fixed it with this:
sudo apt-get install software-properties-common python-software-properties -y
At this point, I was able to add the PPA location:
sudo add-apt-repository ppa:webupd8team/java
Then, you have to update apt-get:
sudo apt-get update
Let’s install Java8:
sudo apt-get install oracle-java8-installer -y
Let’s add JAVA_HOME for the current session, and make it persistent:
sudo nano /etc/environment
Confirm that everything went smootly with the following command, which should show the right version: