Installing Oracle JDK 8 on Raspberry Pi

For installing the latest version of Oracle JDK on Raspberry Pi 3 follow the steps here.

Visit, click the download button of Java Platform (JDK) 8. Click to Accept License Agreement, download jdk-8-linux-arm-vfp-hflt.tar.gz for Linux ARM v6/v7 Hard Float ABI.

Log-in Raspberry Pi, enter the command to extract jdk-8-linux-arm-vfp-hflt.tar.gz to /opt directory.
$ sudo tar zxvf jdk-8-linux-arm-vfp-hflt.tar.gz -C /opt

Set default java and javac to the new installed jdk8.
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1

$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java

After all, verify with the commands with -verion option.
$ java -version
$ javac -version


  1. Thanks -- this helped me, even though I was using the Oracle Java SE Embedded -- same principles at work.

  2. FYI, 'sudo apt-get install oracle-java8-jdk' worked for me, now that it is included in the Raspbian repos.

  3. Put this at the end of your /etc/profile
    export JAVA_HOME="/path/to/java/jdk"
    export PATH=$PATH:$JAVA_HOME/bin

  4. Thankyou! This helped fix the recent issues with my.openHAB servers moving to certificates and requiring a java update!

  5. This comment has been removed by the author.

  6. use command:
    wget --no-check-certificate \

    to download java file from pi command line