I started getting errors on my pi from running a java program that should run on java 8, which i thought i had on my pi, so i did java -version on my pi and it turns out I have java 7 installed (java version "1.7.0_131"). Any idea how to use java 8 on it?

2 Answers 2


You can install oracle java8 jdk following this guide:

  1. modify /etc/apt/sources.list file

    sudo nano /etc/apt/sources.list

    adding this lines:

    deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main 
    deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
  2. install jdk

    sudo apt-get update
    sudo apt-get install oracle-java8-installer
  3. verify installation

    java -version

    output should be:

    java version "1.8.0_131"

Oops... I did some digging and found that you can do "sudo update-alternatives --config java", and select the number corresponding to java 8. It will probably have jdk8 in its path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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