3

I'm not able to install Java 21 on Raspberry Pi 5. I download ARM versions from openJDK and Oracle, but both don't work for me.

When typing ./java it prints: "No such file or directory" (I'm sure I'm in the right directory)

I cannot find any repository I can use to install Java 21 and I need newer version of Java than 17 for my projects written in Java 21.

file ./java output

./java: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, not stripped

ldd ./java output:

java is "not a dynamic executable"

Do you have any idea how I can install Java 21 on Raspberry Pi 5?

How to reproduce:

  • OpenJDK: From website (https://jdk.java.net/21/) I downloaded version for Linux / AArch64, unpacked it and try to run java executable from unpacked directory bin/java using java command inside of the mentioned directory

  • Oracle JDK: I download from website (https://www.oracle.com/pl/java/technologies/downloads/) version for ARM64 Compressed Archive and did exactly as with OpenJDK version.

Distribution is the default for Raspberry Pi 5: Raspberry Pi OS 64 bit (based on Debian)

Output for find / -name java -type f -exec ls -l {} ; 2>/dev/null:

bloodlex@raspberrypi:~/Download/jdk-21.0.1/bin $ find / -name java -type f -exec ls -l {} ; 2>/dev/null -rwxr-xr-x 1 bloodlex bloodlex 70792 10-05 15:44 /home/bloodlex/Download/jdk-21.0.1/bin/java

Output for file /bin/ls:

bloodlex@raspberrypi:~/Download/jdk-21.0.1/bin $ file /bin/ls /bin/ls: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=73a3ba02d9f4bf3632cbebe139c6a844ca5076d3, for GNU/Linux 3.2.0, stripped

Output for uname -a

bloodlex@raspberrypi:~/Download/jdk-21.0.1/bin $ uname -a Linux raspberrypi 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux

12
  • sudo chmod +rx ./java ./java unable to execute ./java: No such file or directory
    – Bloodlex
    Commented Nov 27, 2023 at 14:48
  • How do you do the installation? Commented Nov 27, 2023 at 16:59
  • I download the ARM version from openJDK/Oracle, unpack it and try to run ./java from bin category
    – Bloodlex
    Commented Nov 27, 2023 at 17:07
  • 1
    Add exact steps in the question. and show the result of command: find / -name java -type f -exec ls -l {} \; 2>/dev/null Commented Nov 27, 2023 at 17:10
  • 1
    Not some, but everything but the kernel (hence "userspace"). Not exactly sure why but I recalled as well that's what they decided to have instead of a "wholly 64-bit" system.
    – Tom Yan
    Commented Nov 28, 2023 at 18:29

2 Answers 2

0

I've decided to wipe the SD card from Raspberry (the one that I received in a package with the device) and downloaded a new official Raspberry Pi 5 64 bit image. Now Java works as expected with ARM 64 bit version without any problems. It seems that now also userspace is 64 bit as it should.

So the solution in my case is not to use the default operating system that you can find on the SD card delivered with your Raspberry Pi 5. I recommend to download the official tool and operating system and do it yourself.

0

I stumbled across the same problem. OpenJDK 21 (and above) are not maintained long-term by Oracle, therefore, many distros (including Raspbian) are switching to eclipse temurin (https://adoptium.net/de/temurin/releases/). Therefore, just run sudo apt install temurin-21-jdk and afterwards, java -version (etc.) will run.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .