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?

resuther
  • 190
  • 1
  • 1
  • 9
  • Which one did you try? The Raspberry may need some of the "_arm_" based releases. – Konrad Jun 09 '21 at 06:37
  • Tried some ARM based ones and eventually got it to work thanks to this thread: [Reddit](https://www.reddit.com/r/raspberry_pi/comments/nvp14a/install_java_16_on_raspberry_pi_4/). Thanks for the help anyways :) – resuther Jun 09 '21 at 07:27
  • Please have a look on this [answer](https://raspberrypi.stackexchange.com/questions/4683/how-to-install-the-java-jdk-on-raspberry-pi/4845) from RaspberryPi-SE – gkhaos Jun 11 '21 at 14:09
  • @gkhaos This question is for Java 16. – resuther Jun 19 '21 at 05:48
  • 1
    @resuther the answer is adaptable to any custom java installation – gkhaos Jun 20 '21 at 17:30
  • 1
    There is a raspberry pi forum here: http://raspberrypi.stackexchange.com – NomadMaker Jul 08 '21 at 21:32

1 Answers1

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

resuther
  • 190
  • 1
  • 1
  • 9