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.

  • But you need to know that there are 2 javas: Oracle and Openjdk. It is not quite clear which one you wanted to install. – Pilot6 Mar 15 '16 at 19:39

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

I have done the following in the .profile in my home directory.

JAVA_HOME=/opt/jdk1.7.0_79;export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH

once this was added, just log out and login. This will over ride the path to include jdk1.7.0_79 first. You need to use java 8 folder in this case. eg. if you installed java in /downloads/javajre then add the following in the .profile file of your home directory

JAVA_HOME=/downloads/javajre;export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH

Log out and login. This should set your java -version to java 8.

  • If you noticed, this is not a forum. Please do not post multiple answers. You can edit your answer instead. – Pilot6 Mar 15 '16 at 19:31

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.