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?

2
  • 1
    do either of those packages claim to be raspebrry pi 1 compatible? Commented Feb 3, 2019 at 23:28
  • I'm afraid not, I will have to look for other Java11 versions...
    – Frank
    Commented Feb 4, 2019 at 19:41

1 Answer 1

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.

3
  • 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
    Commented 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. Commented 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
    Commented Feb 26, 2019 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.