Trying To Install Java 8.. Unable to locate package openjdk-8-jre

I'm attempting to install JAVA JRE 8. I have tried following the apt-get's, but it cannot be found there. I attempted to download it straight off Oracle's website, and i have the folder now in my /downloads/javajre folder, but I still have JDK7 on my computer and I don't know how to override it. I added the path variable to my ~./bashrc folder, but it still recognizes JDK7 as the main java version. I also tried to apt-get purge JDK7 and it did uninstall, but it is still appearing for java --version. I also tried to locate the environment variable for JDK7 and I can't find it, it is not in /etc/environment. So I'm trying to get the apt-get to work so I can just change the version via change-configuration, but it can't be found.

I also tried this one, but it didn't work:

sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer 

I need to get this to work. The first is my version, the second is the command and the output.

  lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 14.04.4 LTS
    Release:    14.04
    Codename:   trusty

sudo apt-get install openjdk-8-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openjdk-8-jre

Any ideas? I've been trying to figure this out for like 4 hours now.


Solution 1:

OpenJDK8 is not included in Ubuntu 14.04 repositories.

You can install Openjdk8 to Ubuntu 14.04 from a PPA this way:

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jre