You are using 32 bit VM (Java HotSpot(TM) Client VM) which can be mapped to maximum 4G (Only 2 GB in reality) 2^32 address locations Maximum Java heap size of a 32-bit JVM on a 64-bit OS
Error message suggest you are using 5GB heap memory which is not supported on 32 bit architecture
Invalid maximum heap size: -Xmx5096m The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
You can modify the -Xmx parameter to use anythinng <=2g should work here
Answer from Fairoz on Stack Overflow
I wanted to run a minecraft paper server 1.21.11 on my laptop. I set it up, everything looks fine and I get this error:
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.
Also, it worked on my previous laptop, but doesn`t work on this one. Here is the .bat file:
java -Xms2G -Xmx4G -jar papermc-server.jar
Edit: it works if i delete the -Xms and -Xmx flags, but then it automatically assigns the heap to: 676/5984
You are using 32 bit VM (Java HotSpot(TM) Client VM) which can be mapped to maximum 4G (Only 2 GB in reality) 2^32 address locations Maximum Java heap size of a 32-bit JVM on a 64-bit OS
Error message suggest you are using 5GB heap memory which is not supported on 32 bit architecture
Invalid maximum heap size: -Xmx5096m The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
You can modify the -Xmx parameter to use anythinng <=2g should work here
I just encountered the problem and solved it by downloading the windows 64-bit JAVA.
Please check whether your windows version is 32-bit or 64-bit, and download the right version of JAVA.
java - Invalid maximum heap size: -XX:MaxHeapSize=4096m - Game Development Stack Exchange
Invalid maximum heap size: -Xmx4096M and other errors
This is usually caused by having 32 bit Java Install rather than 64 bit.
From a command prompt, type the following command: java -version
The third line should say, "Java HotSpot(TM) 64-Bit Server VM". If you don't see "64-Bit", then you're running 32 bit.
You can download and install 64 bit java here: (Link)
More on reddit.comInvalid Maximum Heap Size even though I have the RAM and 64 bit Java - Server Support and Administration - Support - Minecraft Forum - Minecraft Forum
Can't set MEMORY for server — "invalid maximum heap size"
Videos
i keep getting this error everytime i open run.bat any fixes?