<< PiJava - Part 2: Installing and running Java 11 on a Raspberry PI 3 Model B+
PiJava - Part 1: Trying to run Java 11 on an old Raspberry PI
TL;DR; It doesn't work with an old PI, buy a recent one ;-)One of my goals for 2019 is experimenting with the latest Java and JavaFX versions on a Raspberry PI. After my experiments with the Python Pong game I was not very happy with the GUI I could build with Python and definitely wanted to try something similar, but with JavaFX which I like much more.
Tools used for first experiments
- Raspberry PI board left-over, Model B+ V1.2 from 2014
- 7" touch screen from earlier experiments, similar to this one
- Kano kit for keyboard and WiFi
- Latest Raspian OS
Starting pointI started with this step-by-step from Gluon to get Java 11 running on the board.
The Java version they are using (Liberica from Bellsoft) only returned "Illegal argument" exception. Thanks to Michael Röschter from Azul Systems I also got two different versions of the embedded Zulu version they build. But those gave me "error while loading shared libraries". So what is going wrong?
Inside information about the PI boardI had to look "inside" the PI to know what is going wrong and why. So it is important to be able to know exactly what is inside the PI being used. So back to my best friend Stackoverflow to get some assistance and find some tips and tricks ;-)
In this GitHub repo I added some scripts based on what I found on-line, which can help you to identify the hardware and software of the PI you are using.
check_raspian_version.shThis script will read out different parameters of the system to give you an overview of the Debian Linux and kernel version.
Debian version: 9.6 Kernel version: 4.14.79+ Full version info: Linux raspberrypi 4.14.79+ #1159 Sun Nov 4 17:28:08 GMT 2018 armv6l GNU/Linux Even more version info: Linux version 4.14.79+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 Sun Nov 4 17:28:08 GMT 2018
check_float_version.shThis script helps you to define which float system is used by the Debian system.
Hard float means floating number calculations are done with a dedicated block in the chip. And soft float is done in software. So the hard float will be faster but needs a chip which supports it. And the filesystem and tools also need to be build to match the floating type.
Soft float? By checking dpkg for armel (if > 0): 0 By checking if directory exists: No Hard float? By checking dpkg for armhf (if > 0): 1063 By checking if directory exists: Yes dpkg architecture: armhf
check_hardware_version.shThis script helps you to define which hardware is used (processor model) and some other stuff like temperature, memory in use...
CPU info: processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2835 Revision : 0010 Serial : 000000002d2617a6 CPU current values: temp=38.5'C frequency(45)=700000000 volt=1.2000V Memory: total used free shared buff/cache available Mem: 433M 67M 184M 3,4M 181M 314M Swap: 99M 0B 99M
Trying-out with a Pi ZeroQuick additional experiment: same SD-card in a Pi Zero. But same "Illegal argument" result.
Side-note: isn't this remarkable. Swapping the SD-card between different Pi's, even completely different types just works. No driver changes needed, no new downloads. Just exchange the SD, power-up and start working! Isn't the Pi a really remarkable, well-built device?!
ConclusionBased on the hardware version, Michael pointed out that "your Raspberry is a pre-2015 version with an ARMv6 chip. I fear the community has to wait till some commercial hardware vendor goes for Java 11 on a low-end ARMv6 chip, which is increasingly unlikely. On ARM is not easy to build a binary that works on every 32bit version. V5, V6 (two variants) and V7 are too different." BTW, also the Pi Zero is an ARMv6-type.
I you look at the overview of Pi-specs on Wikipedia it's clear which boards are supported and which aren't. Looking at the "Instruction set" row, immediately shows which types are based on the ARMv7/8 and which should be supported by the Java 11 of Liberica.
So Java 11 is not (yet) built for my old Raspberry PI...
In the meantime I bought a new one and started all over again.
Spoiler alert: it works "out of the box", but more about that in the next blog.