In this guide, you will get to know how to fix the “Invalid heap size” or “Could not reserve enough space”. You will get to know what the options will appear while doing this and how to reinstall the Java after uninstalling it.
Inside of your Minecraft server folder, you will have run.bat. Go to the Snapshot server folder and open the run.bat file.
There will be the contents of run.bat like java Xmx8G, Xms1024M, jar server.jar,nogui, and pause. If you run it, the screen will pop up and vanish out immediately as there is no pause at the end of the line.
After you run it there will be an invalid maximum heap size: -Xmx8G, the specified size exceeds the maximum representable size, error: could create a java virtual machine, error: a fatal exception has occurred.
Then open up the task manager to see if you have enough space for the server to run.
If you edit the run.bat and change the 8G to 1G, run the server and it will start working. Change it back to 8G after you close it.
You can uninstall a recent program through quick access to the control panel.
If you don’t see the uninstall a program under quick access, you have to click on the control panel and then tap on “uninstall the program”. Just double-click on Java, whatever version you have, and then click on Yes. If you have more than one java installation, then you have to uninstall every one of them.
You will need to google search for Java to install. If you click on the Java Download button, then you may leave with the 32-bit version instead of the 64-bit version.
There’s an option of All Java Downloads at the top of the left-hand corner.
The Windows Online will pick between 32 or 64-bit versions automatically, it fails sometimes and it will happen when you click on the big red Java Download option. Windows Offline is a 32-bit version and Windows Offline (64-bit version) is obviously a 64-bit version.
Then click on the Windows Offline (64-bit version) and tap the run option.
Now all you have to do is close the browser and click on the Install option.
Once you complete the installation process, close it.
Go to the Minecraft server folder and open the run.bat again. You will see the server will start running. When you right-click the run.bat, you will find it will be running with 8 gigabytes of maximum ram, which means it needs enough memory to run smoothly.