Lately I wanted to use Java on the RaspberryPi a little more intensive. With that involved, there is of course a Gradle build. But it went not as easy a I expected.
I attempted to use the openjdk-8 package, the system in question was based on a Hypriot OS 0.7.0 Berry (beta), which is based upon Rasbian Jessie.
While running the build, I ran into some SSL related issues on downloading the dependencies:
Exception in thread "main" javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path validation failed:
java.security.cert.CertPathValidatorException: signature check failed
First of all, I tried to fix it with the commands
sudo update-ca-certificates -f
sudo apt-get install --reinstall ca-certificates-java
but those didn’t seem to have any effect.
From past experience I knew that it’s – unfortunately – often worth to give the official Oracle builds a try in case the OpenJDK does not behave as expected. Even though I have the feeling that shouldn’t be the case anymore as the usage of OpenJDK has been spread a lot. For example, Amazon, being a very big name and serving a large installation base within AWS and it’s other services is using OpenJDK.
Trying to find the most convenient way to get the Oracle JDK installed (using their packages and having to run update-alternatives and such by hand is the least desired option in that case), I learned that the Oracle JDK packages are provided within the RaspberryPi Foundation repositories located at http://archive.raspberrypi.org/debian/
So I added a file foundation.list to /etc/apt/sources.list.d with the content
deb http://archive.raspberrypi.org/debian/ jessie main
and run apt-get update after which apt-cache search oracle listed
oracle-java8-jdk - Java™ Platform, Standard Edition 8 Development Kit
Which I decided to install instead of OpenJDK. And voila – it works. Seems like OpenJDK, or at least the package provided within Raspian has still some things to catch up with
I’m looking for the proper place to report or track this – does anyone have a hint for that?
Oh, and as a side note: Always take case of the CPU architecture you are working with – it’s so easy to fall into that ARM / X86 trap But that’s a topic for another blog post…