By isendev.
Posted on 2017/08/09 23:50.
Tagged as: java, raspberrypi, linux.
This is a quick note that shows how to update Oracle Java 8 on Raspbian / Raspberry Pi.
By default, Raspbian has the following Java 8 Oracle package:
root@rpi3server:~# dpkg --list | grep oracle-java8-jdk
ii oracle-java8-jdk 8u65 armhf Java™ Platform, Standard Edition 8 Development Kit
root@rpi3server:~ $ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
And the default Raspbian repositories do not regurarly update this package.
We need to use the Oracle Java Installer from https://launchpad.net/~webupd8team.
Install the repository key, from keyserver.ubuntu.com.
root@rpi3server:~# gpg --keyserver keyserver.ubuntu.com --recv EEA14886
root@rpi3server:~# gpg --export --armor EEA14886 | sudo apt-key add -
Add the repository URLs to the APT sources config file /etc/apt/sources.list, using your favourite text editor.
root@rpi3server:~# emacs /etc/apt/sources.list
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
Update the repositories.
root@rpi3server:~# apt-get update
Use the installer package to automatically update Oracle Java. You must accept the license messages and confirm the installation when prompted.
root@rpi3server:~# apt-get install oracle-java8-installer
Set the updated Oracle Java as default.
root@rpi3server:~# apt install oracle-java8-set-default
And finally, confirm that everything is fine.
root@rpi3server:~# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Client VM (build 25.144-b01, mixed mode)
Important: Note that all commands are executed as root. If you do not have access to a root shell (by default you are not allowed to use it), use sudo to execute them (prefix all commands with "sudo").