I want to start experimenting with Java on a PI, following this guide http://docs.gluonhq.com/embedded/#_setting_up_the_raspberry_pi and started with
- PI ARMv6 rev 7 (v61)
- Kernel Linux 4.14.79+
- Raspian GNU/Linuxx 9 (stretch)
And tried two Java 11 versions
- https://www.azul.com/downloads/zulu-embedded/> 11> Arm 32bit JDK on Linux (for Armv8/v7/v6 Hard Float ABI)
- https://github.com/bell-sw/Liberica/releases/download/jdk11%2B28/bellsoft-jdk11+28-linux-arm32-vfp-hflt.tar.gz
Untarred both to a directory in /opt/. But both give an error "Illegal argument" when trying out these commands
/opt/jdk-11/bin/java -version
/opt/zulu11.1.8/bin/java -version
Am I using wrong versions?
-
1do either of those packages claim to be raspebrry pi 1 compatible?Jaromanda X– Jaromanda X2019年02月03日 23:28:49 +00:00Commented Feb 3, 2019 at 23:28
-
I'm afraid not, I will have to look for other Java11 versions...Frank– Frank2019年02月04日 19:41:02 +00:00Commented Feb 4, 2019 at 19:41
1 Answer 1
Linux applications are not portable across all distributions of the same architecture and ABI. This is mainly because different distributions use different versions of libc
, but there may be other, more subtle reasons. Because of this, every Linux distribution comes with an official repository you can get the compatible software from.
Also, most packages targeting Debian armhf
are built with VFP3-D16 hardware support and thus won't work with software built for ARMv6 CPUs (which only have VFP2). Take a look at the java
file you have installed with readelf
or objdump
to see what exact architecture it's built for. If you see CPU_arch: v7
, FP_arch: VFPv3
or something along the lines, that won't work on an RPi.
Since both packages you have tried out are based on OpenJDK, you should be able to build them from sources.
-
My experimentation board is a Model B+ v1.2. The exact same info "CPU_arch" or "FP_arch" I can't find, using "readelf -h java"Frank– Frank2019年02月04日 18:53:57 +00:00Commented Feb 4, 2019 at 18:53
-
1@Frank What exact hardware you have is not important, it's not a question of compatibility between the software and the hardware. It's a question of compatibility between different parts of software, namely JDK (likely built for ARMv7) and Raspbian (built for ARMv6). Perhaps I didn't explain that clearly.Dmitry Grigoryev– Dmitry Grigoryev2019年02月05日 14:27:56 +00:00Commented Feb 5, 2019 at 14:27
-
Restarted my experiments with the latest PI and can now run Java without any problems! Thanks for the info.Frank– Frank2019年02月26日 11:34:33 +00:00Commented Feb 26, 2019 at 11:34