Why startup flags matter
Java's default settings are made for general programs, not a game server that creates millions of short-lived objects every second. Without tuning, memory cleanup can freeze the server for a moment, which players feel as lag spikes.
Above 12 GB, the generator switches to Aikar's large-heap variant, which gives the collector bigger regions and more room for new objects.
Frequently asked questions
What are Aikar's flags?
A set of Java garbage-collection settings tuned for Minecraft servers by Aikar, and recommended by PaperMC. They reduce lag spikes caused by Java cleaning up memory.
Should -Xms and -Xmx be the same?
Yes, for a dedicated server. Setting both to the same value means Java reserves all its memory at startup and never spends time growing or shrinking the heap.
Which Java version does my Minecraft server need?
Minecraft 1.20.5 to 1.21.x needs Java 21, 1.18 to 1.20.4 needs Java 17, and 1.16.5 and older run on Java 8. The newest releases need a newer Java again; the generator shows the right one for each version.
How do I make a start.bat for a Minecraft server?
Pick Windows above, copy the start.bat contents into a file named start.bat in your server folder, and double-click it. The pause line keeps the window open so you can read any errors.
Do Aikar's flags work with Forge and Fabric?
Yes. They work with any Java server. For Forge and NeoForge on 1.17 and newer, put them in user_jvm_args.txt instead of the start command.