Skip to content

Startup Flags

Get Aikar's JVM flags and a start.sh or start.bat file for Paper, Purpur, Fabric, Forge and Velocity.

Server

The exact file name of your server jar.

Memory

Heap given to Java, not the machine’s total RAM

8G

Flags & options

Heap
8G
-Xms = -Xmx
Machine RAM to have
10 GB+
Heap plus OS headroom
start.sh
#!/usr/bin/env sh
cd "$(dirname "$0")"

java -Xms8G -Xmx8G \
  -XX:+UseG1GC \
  -XX:+ParallelRefProcEnabled \
  -XX:MaxGCPauseMillis=200 \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+DisableExplicitGC \
  -XX:+AlwaysPreTouch \
  -XX:G1NewSizePercent=30 \
  -XX:G1MaxNewSizePercent=40 \
  -XX:G1HeapRegionSize=8M \
  -XX:G1ReservePercent=20 \
  -XX:G1HeapWastePercent=5 \
  -XX:G1MixedGCCountTarget=4 \
  -XX:InitiatingHeapOccupancyPercent=15 \
  -XX:G1MixedGCLiveThresholdPercent=90 \
  -XX:G1RSetUpdatingPauseTimePercent=5 \
  -XX:SurvivorRatio=32 \
  -XX:+PerfDisableSharedMem \
  -XX:MaxTenuringThreshold=1 \
  -Dusing.aikars.flags=https://mcflags.emc.gs \
  -Daikars.new.flags=true \
  -jar paper.jar --nogui

Put it next to the jar, run chmod +x start.sh once, then start the server with ./start.sh.

On Pterodactyl or another panel host, the panel starts the server itself and this script isn’t used. Set memory in the panel instead.

Why Xms and Xmx are the same

-Xms is the starting heap and -Xmx the maximum. Setting both to the same value means Java claims the memory once at startup, which -XX:+AlwaysPreTouch relies on, and never spends time growing or shrinking the heap. The garbage collector also tunes itself better around a fixed size.

Leave room for the system

Java uses memory beyond the heap for threads, code and network buffers. On a machine or VPS you control, give the server 1 to 2 GB less than the total so the OS and that overhead fit. If the machine runs out, the kernel kills the server outright.

Hosting panels like Pterodactyl build the Java command themselves from the container’s memory limit, so a start script there is ignored. Change flags in the panel’s startup settings if your host allows it, and keep the heap below the container limit.

About the flags

Aikar’s flags tune the G1 garbage collector for Minecraft’s pattern of many short-lived objects, which keeps GC pauses short. They are the flags PaperMC recommends. Minecraft 26.1 and newer needs Java 25. Versions 1.20.5 to 1.21.11 need Java 21. Not sure how much RAM to give? Try the RAM calculator.

ZCraft Studios

Want us to set up your server?

Our team installs and configures plugins, sets up game modes, fixes errors and tunes performance. You talk to us directly on Discord.