Still loading

SBlock works beside a server rack and settings sheet.
Minecraft · Guide

Set up Paper startup scripts and Aikar JVM flags

Pair Paper with the right Java release, configure start scripts with Aikar's G1GC flags, and measure early server health using Spark.

On this page

Official startup and profiling tools

A startup script sets the Java command and memory options used to run Paper. PaperMC documents an optional set of Aikar’s G1GC flags; compare settings and test them for your workload . Use spark to investigate server performance when a problem occurs .

Required server and profiler downloads

PaperMC official project iconPaperMCJava Edition server JAR and official Aikar startup documentation.Docsspark profiler official iconsparkLow-overhead CPU profiler, MSPT monitor, and memory inspector.Modrinth

Size heap memory below host limits

The Java heap is only part of a server’s memory use. Leave room for the operating system, native JVM allocations, plugins and other processes, and monitor actual usage under load. PaperMC’s Aikar guide offers examples; the right heap size depends on your world, players and host .

Data table

Illustrative heap allocations; measure host and JVM usage before choosing

Illustrative heap allocations; measure host and JVM usage before choosing
VPS total RAMExample heapOS headroom leftNote
4 GB2500M to 3G1 GB+Example only; workload and native memory vary
8 GB6G2 GBExample only; workload and native memory vary
12 GB10G2 GBExample only; workload and native memory vary
16 GB12G to 14G2 GB to 4 GBExample only; workload and native memory vary

Linux start.sh script with Aikar flags

The example uses Aikar’s G1GC flags documented by PaperMC. Their effect depends on the JVM and workload; compare the current official guide for your heap size and test before using them on a live server .

Hand-drawn stack diagram showing SBlock and Aruhi inspecting Java startup flags above Paper, config files, and plugins
Startup order from Java runtime flags through Paper configuration files and plugin folders.INFIRALS · AI-assisted illustration
PaperMC recommended start.sh template for heaps under 12 GB (adjust 6G to match your host)
#!/usr/bin/env bash
java -Xms6G -Xmx6G \
  -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

Windows start.bat script and file naming

On Windows, place start.bat in the server directory and make sure the -jar argument matches the downloaded file. Quote paths containing spaces. The example uses optional G1GC flags; check your Java version, heap and current Paper guidance before applying them .

Windows batch launcher with pause so boot errors remain visible
@echo off
java -Xms4G -Xmx4G -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
pause

Running inside tmux or systemd on Linux

An ordinary SSH session may end its child processes when it disconnects. A tmux session or a properly configured service manager can keep the server running independently. Detach with Ctrl+B, then D, and reattach with tmux attach -t mc-smp. Stop Paper cleanly using its console stop command before maintenance. Avoid force-killing it during writes.

Launch Paper cleanly inside a detachable tmux session on Ubuntu or Debian
chmod +x start.sh
tmux new-session -d -s mc-smp './start.sh'
tmux attach -t mc-smp

Verify startup health with spark before adding plugins

Paper 1.21 and later includes spark. Use it to establish a baseline and capture a profile while an issue is happening . For initial boot checks, see the Java SMP setup guide.

Startup and flag verification steps

  • Check Paper’s recommended Java version for the exact server release and verify it with java -version .
  • Leave memory for the operating system, native JVM usage and other processes; monitor actual usage .
  • Check -jar paper.jar matches the exact JAR name in your server directory .
  • Wrap Linux launches in tmux or systemd and stop via stop, never kill -9.
  • Confirm /spark health shows low GC pause overhead on a clean idle server .

Frequently asked questions

Should -Xms always equal -Xmx on a Minecraft Paper server?

Equal initial and maximum heaps are an option in Aikar’s example, but they are not mandatory for every server. Choose settings appropriate to the host and measure the result.

What should I do if a managed game host locks Java startup flags?

Check your host’s startup settings or ask its support which flags are already supplied. Avoid adding duplicate heap arguments.

Do modern Java 21 or Java 25 builds use ZGC instead of Aikar's G1GC flags?

Paper documents an optional G1GC configuration. Collector choice depends on the Java version and workload; benchmark changes before applying them to production.

Why does start.bat end with pause on Windows?

Adding pause keeps the console window open if Java fails to find paper.jar or hits a version mismatch, making error messages readable.

Next step in the Paper baseline

Java SMP server setup guidePaper plugin troubleshooting

Sources & evidence

Was this article helpful?

Share this post