5

I have tried multiple releases from here using :

sudo -i 
cd /usr/lib/jvm
wget [release link here]
tar xzf [file name here]
export PATH=$PWD/[dir here]/bin:$PATH
java -version

But after java -version I always get:

/usr/lib/jvm/[dir here]/bin/java: cannot execute binary file: Exec format error

Which means I have chosen the wrong release/architecture. Is there a release that works with Raspberry Pi's or is there another way to install Java 16?

6
  • Which one did you try? The Raspberry may need some of the "arm" based releases.
    – Konrad
    Jun 9, 2021 at 6:37
  • Tried some ARM based ones and eventually got it to work thanks to this thread: Reddit. Thanks for the help anyways :)
    – resuther
    Jun 9, 2021 at 7:27
  • Please have a look on this answer from RaspberryPi-SE
    – gkhaos
    Jun 11, 2021 at 14:09
  • 1
    @resuther the answer is adaptable to any custom java installation
    – gkhaos
    Jun 20, 2021 at 17:30
  • 1
    There is a raspberry pi forum here: raspberrypi.stackexchange.com
    – NomadMaker
    Jul 8, 2021 at 21:32

1 Answer 1

13

Answering my own question.

cd [minecraft directory here]

wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk16u-2021-05-08-12-45/OpenJDK16U-jdk_arm_linux_hotspot_2021-05-08-12-45.tar.gz

tar xzf OpenJDK16U-jdk_arm_linux_hotspot_2021-05-08-12-45.tar.gz

export PATH=$PWD/jdk-16.0.1+4/bin:$PATH

java -version

You might have to do export PATH=$PWD/jdk-16.0.1+4/bin:$PATH after a reboot

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