How to use the Minecraft Server Java Version and Startup Flags Generator
- Choose version and software. Pick the Minecraft version range and the server software. Forge and NeoForge use a different start method from the rest.
- Set the memory. Move the slider to the amount Java may use. Keep 1 to 2 GB free on the machine for the operating system.
- Copy the file. Copy the start file, or the one-line command. For Forge and NeoForge, copy the lines into user_jvm_args.txt.
- Check your Java. Run java -version in a terminal. The first number must match the Java version the tool shows.
Which Java each version needs
- Minecraft 1.13 to 1.16.5: Java 8.
- Minecraft 1.17: Java 16 at least, and Java 17 works.
- Minecraft 1.18 to 1.20.4: Java 17.
- Minecraft 1.20.5 to 1.21.11: Java 21.
- Minecraft 26.1 and newer: Java 25.
A newer Java is often fine for older server software, but an older Java will not run a newer server. The server stops at startup with a class file version error when Java is too old.
What the flags do
The memory flags set the minimum and the maximum heap to the same size, so Java does not spend time growing and shrinking it. The rest tune the G1 garbage collector, the Java system that frees memory the server no longer uses. They keep the pauses short, which shows up as fewer lag spikes. They are the flags the Paper community has used for years, with the settings for heaps above 12 GB in the larger version.
One of them, AlwaysPreTouch, claims all the memory when the server starts. That makes the first start slower and means the machine must really have that memory free.
Forge and NeoForge
Forge and NeoForge for Minecraft 1.17 and newer create a run script and a file named user_jvm_args.txt when you run their installer. Put the memory and flags in that file, one per line, and start the server with the run script. Older Forge starts from a jar like the other software.
How much memory to give
Java uses more than the heap, so the machine needs spare memory on top of what you give the server. For plugin servers a few gigabytes is plenty for small groups, and modded servers with big packs need more. The RAM guide has the numbers for each case.
Frequently asked questions
Which Java do I need for Minecraft 1.21?
Java 21 for 1.20.5 through 1.21.11. Minecraft 26.1 and newer need Java 25.
Should I use these flags on vanilla?
They work, but the gain is largest on Paper and its forks. The vanilla server runs fine without them.
Why is the first start slow with these flags?
AlwaysPreTouch reserves all the memory up front. It is a one-time cost at each start.
Can I give the server all my RAM?
No. Leave at least 1 to 2 GB for the operating system and Java's own needs, or the machine will start swapping.
Where does the start file go?
In the server folder, next to the server jar. Run it from there.
Do I need this on ChicagoServers?
No. The panel sets the Java version, software and memory for you.