2

I installed java 11.0.7-open using sdkman and I get this error:

bash: /home/pi/.sdkman/candidates/java/11.0.7-open/bin/java: cannot execute binary file: Exec format error

when running java --version or java -jar some_file.jar (specifically 'SKlauncher 3-beta.15.jar').

Why do I get this error and how to make java work?

15
  • What is the output of the command file /home/pi/.sdkman/candidates/java/11.0.7-open/bin/java ?
    – Ephemeral
    May 12, 2020 at 11:27
  • @Ephemeral if you mean the content inside the file, then it's encoded
    – Cimlah
    May 12, 2020 at 11:36
  • No the result of the command file /home/pi/.sdkman/candidates/java/11.0.7-open/bin/java
    – Ephemeral
    May 12, 2020 at 11:37
  • .sdkman/candidates/java/current/bin/java: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=092cfbfe7cf2936bdbc489b4ec39bebcff2b0b12, not stripped
    – Cimlah
    May 12, 2020 at 11:40
  • 3
    Doesn't look that it's about 32 or 64 bit. That executable is for x86 (Intel) processors, not for ARM.
    – Dirk
    May 12, 2020 at 12:38

1 Answer 1

2

Not only 32-bit versus 64-bit is important, but also that the JDK is compiled for the ARM-processor. For that reason I prefer to use BellSoft LibericaJDK which has a Raspberry Pi-version and also includes JavaFX in case you want to run a JavaFX UI-application.

E.g. to use JDK 13 on Raspbian OS:

$ cd /home/pi
$ wget https://download.bell-sw.com/java/13/bellsoft-jdk13-linux-arm32-vfp-hflt.deb
$ sudo apt-get install ./bellsoft-jdk13-linux-arm32-vfp-hflt.deb
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java

When this is done, we can check the version again and it should look like this:

$ java --version
openjdk version "13-BellSoft" 2019-09-17
OpenJDK Runtime Environment (build 13-BellSoft+33)
OpenJDK Server VM (build 13-BellSoft+33, mixed mode)

More info on https://webtechie.be/post/2020-04-08-installing-java-and-javafx-on-raspberry-pi/

0

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.