Start script and JVM flags generator
Make a start.sh or start.bat for Paper, Purpur, Spigot, Fabric, Forge or vanilla, with the right memory settings and Aikar's flags.
Save this as start.sh
Put it in your server folder and start the server with chmod +x start.sh && ./start.sh.
What the settings do
-Xmx is the most memory Java may use for the server and -Xms what it starts with. Setting both to the same value, as the generator does, stops the server from growing and shrinking its memory while people play. Java needs some memory on top of -Xmx, so never use everything you have: on a machine or plan with 8 GB, give the server about 6.5 GB (PaperMC's advice is 1 to 1.5 GB less than the total).
Not sure how much to give it? The RAM calculator gives a starting point. More is not always better: a big heap with only a few players online makes garbage collection pauses longer.
Aikar's flags
A set of settings for Java's G1 garbage collector, written by Aikar and recommended in the PaperMC documentation. They make the short freezes when Java cleans up memory less noticeable, and they work on Purpur, Spigot, Fabric and Forge too. PaperMC suggests 6 to 10 GB for the collector to work at its best, but a small server with friends runs fine on less.
Which Java version?
| Minecraft version | Java needed |
|---|---|
| 26.1 and newer | Java 25 |
| 1.20.5 to 1.21.11 | Java 21 |
| 1.18 to 1.20.4 | Java 17 |
| 1.17 | Java 16 or 17 |
| 1.16 and older | Java 8 or 11 |
If the server stops right away with "UnsupportedClassVersionError", it needs a newer Java than the one installed. Run java -version to see what you have.
Forge and NeoForge
Since Minecraft 1.17 the Forge and NeoForge installers create their own run.sh and run.bat. Those read the memory settings from user_jvm_args.txt, so the generator gives you that file instead of a start script.
On a game host
Hosting panels like Pterodactyl start the server for you and set the memory from your plan. You only need a start script if you run the server on your own machine or a VPS.