4

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

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?

Frank
  • 318
  • 1
  • 8

1 Answers1

5

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.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144
  • 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 Feb 04 '19 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 Feb 05 '19 at 14:27
  • Restarted my experiments with the latest PI and can now run Java without any problems! Thanks for the info. – Frank Feb 26 '19 at 11:34