Install and Update Java on Raspberry Pi – Oracle JDK 8
Oracle Java offers significant performance advantages over OpenJDK on ARM platforms, and will expand the range of Java applications that run well on the Pi. Latest versions of Raspbian come pre-bundled with java (hard-float version) as mentioned here http://www.raspberrypi.org/oracle-java-on-raspberry-pi/
You can user the below command to check for the version of Java installed with your version of Raspbian.
dpkg --get-selections | grep jdk
If you want to use the latest version, you need to download the JDK directly from the Oracle’s website. Since Raspberry Pi is powered by ARM processor and Raspbian is a 32-bit OS, choose the Linux ARM 32 Hard Float ABI version. With following command, you can determine if your OS is 32 or 64 bit:
When you download the right package, unpack it into /usr/java directory:
sudo mkdir /usr/java cd /usr/java sudo tar -xzf jdk-8u131-linux-arm32-vfp-hflt.tar.gz
You can then create symbolic links in /usr/bin folder (so you’ll be able to use java command anywhere) by adding the following alternatives:
sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_131/bin/java 1000 sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_131/bin/javac 1000
You can now verify that your Java installation works by running the following command:
If you get an output similar to this then you have successfully installed Java 8 on Raspberry Pi.
java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)