TheSenate
Posts: 2
Joined: Thu Jun 18, 2020 2:27 am

64-bit Java on RPi4

Thu Jun 18, 2020 2:32 am

So I'm trying to run Minecraft server for my friends and I to use. I have a Raspberry Pi 4B with 8GB RAM, and I want to dedicate 4 out of the 8 gigs to the server. When I try to do so, the Java output is:

Code: Select all

Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I'm assuming this is because the installed version of Java is 32-bit, which is limiting the maximum amount of memory available to the VM. I followed the instructions at viewtopic.php?t=250730 to use the 64-bit kernel, but I'm unsure of how to use a 64-bit installation of Java. Any help would be much appreciated.

fruitoftheloom
Posts: 25777
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 64-bit Java on RPi4

Thu Jun 18, 2020 8:07 am

TheSenate wrote:
Thu Jun 18, 2020 2:32 am
So I'm trying to run Minecraft server for my friends and I to use. I have a Raspberry Pi 4B with 8GB RAM, and I want to dedicate 4 out of the 8 gigs to the server. When I try to do so, the Java output is:

Code: Select all

Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I'm assuming this is because the installed version of Java is 32-bit, which is limiting the maximum amount of memory available to the VM. I followed the instructions at viewtopic.php?t=250730 to use the 64-bit kernel, but I'm unsure of how to use a 64-bit installation of Java. Any help would be much appreciated.

RaspiOS ARMHF is by default 32bit Kernel and 32bit Userland, changing to the 64bit Kernel it is 64bit Kernel and 32bit Userland.


There is now a a testing version of RaspiOS ARM64 which is 64bit Kernel and 64bit Userland

http://downloads.raspberrypi.org/raspio ... 020-05-28/
The information is out there....you just have to let it in.

My other Linux machines are a ChromeBox & Intel CoreDuo Desktop

TheSenate
Posts: 2
Joined: Thu Jun 18, 2020 2:27 am

Re: 64-bit Java on RPi4

Thu Jun 18, 2020 11:49 am

fruitoftheloom wrote:
Thu Jun 18, 2020 8:07 am
TheSenate wrote:
Thu Jun 18, 2020 2:32 am
So I'm trying to run Minecraft server for my friends and I to use. I have a Raspberry Pi 4B with 8GB RAM, and I want to dedicate 4 out of the 8 gigs to the server. When I try to do so, the Java output is:

Code: Select all

Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I'm assuming this is because the installed version of Java is 32-bit, which is limiting the maximum amount of memory available to the VM. I followed the instructions at viewtopic.php?t=250730 to use the 64-bit kernel, but I'm unsure of how to use a 64-bit installation of Java. Any help would be much appreciated.

RaspiOS ARMHF is by default 32bit Kernel and 32bit Userland, changing to the 64bit Kernel it is 64bit Kernel and 32bit Userland.


There is now a a testing version of RaspiOS ARM64 which is 64bit Kernel and 64bit Userland

http://downloads.raspberrypi.org/raspio ... 020-05-28/
Wow, sounds promising. So would that let me create the 4GB JVM? Also, is there anything I have to do with my installation of Java (right now, I have default-jdk installed).

bullen
Posts: 409
Joined: Sun Apr 28, 2013 2:52 pm

Re: 64-bit Java on RPi4

Tue Jul 21, 2020 1:26 pm

I'm struggling with this too, I tried downloading Linux ARM 64 Hard Float ABI: https://www.oracle.com/java/technologie ... loads.html

But it gives HeadlessException!

Where can we find 64-bit Java?

Edit: found it, sudo apt-get install openjdk-11-jdk
Last edited by bullen on Wed Jul 22, 2020 12:00 am, edited 1 time in total.
https://github.com/tinspin/rupy - A tiny Java async HTTP application server.

knute
Posts: 664
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: 64-bit Java on RPi4

Tue Jul 21, 2020 10:43 pm

bell-sw.com

msk
Posts: 1
Joined: Wed Jan 13, 2021 10:37 am

Re: 64-bit Java on RPi4

Wed Jan 13, 2021 10:46 am

bullen wrote:
Tue Jul 21, 2020 1:26 pm
I'm struggling with this too, I tried downloading Linux ARM 64 Hard Float ABI: https://www.oracle.com/java/technologie ... loads.html

But it gives HeadlessException!

Where can we find 64-bit Java?

Edit: found it, sudo apt-get install openjdk-11-jdk
bullen,

I am also trying to install 64 bit java on RPi4, may I know the OS details on which your able to install 64 bit java?
I tried install java 64 bit on raspberry pi 32 bit version, but it failing with error package not found.

fruitoftheloom
Posts: 25777
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 64-bit Java on RPi4

Wed Jan 13, 2021 1:07 pm

msk wrote:
Wed Jan 13, 2021 10:46 am
bullen wrote:
Tue Jul 21, 2020 1:26 pm
I'm struggling with this too, I tried downloading Linux ARM 64 Hard Float ABI: https://www.oracle.com/java/technologie ... loads.html

But it gives HeadlessException!

Where can we find 64-bit Java?

Edit: found it, sudo apt-get install openjdk-11-jdk
bullen,

I am also trying to install 64 bit java on RPi4, may I know the OS details on which your able to install 64 bit java?
I tried install java 64 bit on raspberry pi 32 bit version, but it failing with error package not found.

You can run Raspberry Pi ARM64 Beta Operating System, and install openjdk from the repositories:

http://downloads.raspberrypi.org/raspio ... 020-08-24/


After install you will need a full upgrade:

Code: Select all

sudo apt update
sudo apt full-upgrade
sudo reboot

The ARM64 release is based of Debian Buster ARM64 and therefore 64bit kernel and userland.
The information is out there....you just have to let it in.

My other Linux machines are a ChromeBox & Intel CoreDuo Desktop

User avatar
subw0fer
Posts: 10
Joined: Sat Dec 26, 2020 7:07 pm

Re: 64-bit Java on RPi4

Tue Feb 23, 2021 6:03 pm

Can somebody recommend optimized version for RPI64? I've tried to find old Oracle 8 versions, but it seems they all disappeared due to licensing. Open JDK not so optimized according to tests.

Is Liberica only option? Has somebody tried it?

fruitoftheloom
Posts: 25777
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 64-bit Java on RPi4

Tue Feb 23, 2021 6:20 pm

subw0fer wrote:
Tue Feb 23, 2021 6:03 pm
Can somebody recommend optimized version for RPI64? I've tried to find old Oracle 8 versions, but it seems they all disappeared due to licensing. Open JDK not so optimized according to tests.

Is Liberica only option? Has somebody tried it?

https://www.oracle.com/uk/java/technolo ... loads.html
The information is out there....you just have to let it in.

My other Linux machines are a ChromeBox & Intel CoreDuo Desktop

User avatar
subw0fer
Posts: 10
Joined: Sat Dec 26, 2020 7:07 pm

Re: 64-bit Java on RPi4

Tue Feb 23, 2021 7:40 pm

This doesn't work, I don't know why. I downloaded jdk-8u191-linux-arm64-vfp-hflt.tar.gz and installed it, but it gives error, I think something with the version is wrong.

Code: Select all

pi@raspberrypi:~ $ java - version
-bash: /opt/jdk1.8.0_191/bin/java: cannot execute binary file: Exec format error
pi@raspberrypi:~ $

knute
Posts: 664
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: 64-bit Java on RPi4

Wed Feb 24, 2021 4:39 pm

subw0fer wrote:
Tue Feb 23, 2021 7:40 pm
This doesn't work, I don't know why. I downloaded jdk-8u191-linux-arm64-vfp-hflt.tar.gz and installed it, but it gives error, I think something with the version is wrong.

Code: Select all

pi@raspberrypi:~ $ java - version
-bash: /opt/jdk1.8.0_191/bin/java: cannot execute binary file: Exec format error
pi@raspberrypi:~ $
I don't know why you would want Java 8, it is past end of life. Liberica works fine on the RaspiOS 64 beta and I'm sure OpenJDK11 would too. OpenJDK and Oracle are using the same code these days so there should be no significant performance difference between them.

User avatar
subw0fer
Posts: 10
Joined: Sat Dec 26, 2020 7:07 pm

Re: 64-bit Java on RPi4

Wed Feb 24, 2021 7:43 pm

Yes, this is that I found also, got Liberica and already installed it. Thanks for suggestions, though.

mattlewis
Posts: 123
Joined: Sat Jan 12, 2013 3:05 pm
Location: UK
Contact: Website

Re: 64-bit Java on RPi4

Fri Feb 26, 2021 4:33 pm

I use Ubuntu 64bit and the packaged OpenJDK install (via apt) and all works well with diozero - https://github.diozero.com.
http://www.diozero.com/

Return to “Java”