Installing Oracle JDK 8 on Raspberry Pi


This post will show how to download and set up Oracle JDK 8  on Raspberry Pi.

Visit http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, 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

7 comments

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

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

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

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

    ReplyDelete