I recently setup a minecraft server on my raspberry pi 4 8GB running ubuntu server version 20.04, everything on the server works fine, but when I try to allocate 4 gigabytes of ram to the server with the command:java -Xmx4G -Xms4G -jar minecraft_server.1.17.jar nogui. I get the error that this number exceeds the maximum heap size even though, when I give the free command it says I have over 6 GB of free memory. I'm running java 16 but I'm not sure if it is 32 or 64 bit since I used apt install to install it. When I do java -version I get openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment (build 16.0.1+9-Ubuntu-1) OpenJDK Server VM (build 16.0.1+9-Ubuntu-1, mixed mode) The maximum it lets me allocate now is 2 GB so I was wondering if there was anyway to fix the issue.

  • are you running a 64bit operating system? Commented Jun 9, 2021 at 2:56

1 Answer 1


I got mine working with an installer for Java 17 following this video: https://www.youtube.com/watch?v=bT-siImC0tM

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.