Minecraft start script generator
Enter memory, server type and Java version and get a start script with JVM flags that stays within the memory limit.
- free, no sign-up
- Java 8–25
- nothing leaves your browser
Server
Everything is calculated in your browser, nothing is sent.Server type
Minecraft version
The version decides the Java version.You can change the Java version manually.
Server memory
8 GBHow much memory the server may use in total. With hosting it is the plan size, on your own machine not the whole RAM.
Number of plugins or mods
The count sets the memory for loaded classes.
Where the server runs
Garbage collector
ZGC needs Java 21 and pays off from 16 GB RAM.
Options
Name of the server jar file.
MALLOC_ARENA_MAX=2 java -Xms5440M -Xmx5440M -XX:MaxDirectMemorySize=512M -XX:ReservedCodeCacheSize=240M -XX:MaxMetaspaceSize=512M -XX:TrimNativeHeapInterval=60000 -Djdk.nio.maxCachedBufferSize=262144 -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:InitiatingHeapOccupancyPercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:+UseTransparentHugePages -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar nogui
Paste into the Startup Command field. The MALLOC_ARENA_MAX=2 prefix works in yolks images, remove it in others. Set the server memory in the panel to the chosen value.
Memory
Heap 5,440 MB · Limit 8,192 MB- Heap
- 5,440 MB
- Garbage collector
- 190 MB
- Loaded classes
- 252 MB
- Compiled code
- 304 MB
- Network buffers (cap)
- 512 MB
- Threads
- 64 MB
- Java and system
- 400 MB
- Reserve
- 1,030 MB
Container limit: 8,602 MB. The panel gives the container 5–15 % more than the plan. Above this number the system stops the server.
Why the heap is not all the RAM
Java needs memory outside the heap too: network buffers, loaded classes, compiled code, threads and the system allocator. Without caps these parts keep growing until the process exceeds its limit and the system stops the server without an error in the log. That is why the large parts are capped and the heap gets what is left.
What the flags do
- MALLOC_ARENA_MAX=2
- Limits the number of glibc allocator arenas. On a machine with many cores there can otherwise be over a hundred.
- -Xms5440M -Xmx5440M
- Heap size. Equal -Xms and -Xmx make Java take the memory right at start.
- -XX:MaxDirectMemorySize=512M
- Cap for network buffers. Without it they can grow up to the heap size.
- -XX:ReservedCodeCacheSize=240M
- Cap for compiled code.
- -XX:MaxMetaspaceSize=512M
- Cap for classes loaded by plugins and mods. A leak ends with an error in the log instead of a crash.
- -XX:TrimNativeHeapInterval=60000
- Returns memory the allocator no longer needs to the system once a minute.
- -Djdk.nio.maxCachedBufferSize=262144
- Limits the size of temporary buffers kept by each thread.
- -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1
- The G1 garbage collector tuned as in the Paper documentation: short pauses and quick cleanup of short-lived objects.
- -XX:+DisableExplicitGC
- Ignores manual garbage collector calls from plugins.
- -XX:+AlwaysPreTouch
- Claims the whole heap at start. A wrong setting shows up immediately, not hours later.
- -XX:+PerfDisableSharedMem
- Turns off writing performance statistics to disk.
- -XX:+UseTransparentHugePages
- Large memory pages for the heap (Linux).
How to create a start script for a Minecraft server
Choose the server type (Paper, Purpur, Fabric, Forge, NeoForge, Velocity…) and the Minecraft version, which sets the Java version.
Enter the server memory – your plan size, or how much RAM the server may use on your own machine – and roughly how many plugins or mods you run.
Pick where the server runs (Pterodactyl, Docker, Linux, Windows) and the G1 or ZGC garbage collector.
Under Options, adjust the name of the server jar file; on Linux and Windows you can also turn on automatic restart and a GC log.
Copy or download the script and save it next to the server jar. For Pterodactyl, paste the line into the Startup Command field.
About this tool
This Minecraft start script generator builds a startup script with JVM flags for your server: start.sh for Linux, start.bat for Windows and a startup command for Pterodactyl or Docker.
Choose the memory, server type (Paper, Purpur, Fabric, Forge, NeoForge, Velocity) and Java version and you get -Xmx and -Xms set correctly, the proven Aikar's flags for G1GC (larger regions from a 12 GB heap) or ZGC, and caps for off-heap memory.
The script stays within the memory limit of your container or VPS, so the server doesn't crash from running out of RAM. Copy or download the finished script.
- Servers
- Paper · Fabric · Forge · Velocity
- Runs on
- Pterodactyl · Docker · Linux · Windows
- GC
- G1 · ZGC (Java 21+)
- Memory
- heap + off-heap caps
- Sent to a server
- never
Frequently asked questions
Answers to the questions people ask most about this tool.
What are Aikar's flags?
A set of JVM options for the G1 garbage collector put together by Aikar for Minecraft servers and recommended by Paper. They shorten GC pauses and therefore lag spikes. The generator applies them automatically and tunes them for heaps of 12 GB and more.
What should I set -Xmx and -Xms to?
Usually the same value, so Java doesn't have to grow the heap while running. On hosting or in a container don't use the whole limit, though: Java also needs off-heap memory, so the generator leaves headroom.
Should I use G1GC or ZGC?
G1 with Aikar's flags is the safe choice for most servers. Generational ZGC (Java 21+) pays off mainly with large heaps, where it keeps pauses very short. The generator offers both depending on the Java version.
Does it work for Velocity or BungeeCord?
Yes. For proxies (Velocity, BungeeCord, Waterfall) the generator uses the flags from the Velocity documentation with smaller G1 regions.
Related
- Minecraft server performance: lag, flags, view distance, Chunky and sparkHow to find out what slows your server down and how to fix it: TPS and MSPT, startup flags and memory, view distance, Paper settings, pre-generating the world with Chunky and profiling with spark.
- Minecraft server types: Paper, Purpur, Fabric, Forge, NeoForge and moreA comparison of every server type we offer: Paper, Purpur, Folia, Vanilla, Fabric, Forge and NeoForge. The difference between plugins and mods, and how to choose a type.
- A server network with Velocity: lobby, survival and minigames on one addressHow to connect several Minecraft servers with a Velocity proxy: installation, velocity.toml line by line, modern forwarding, Paper and Fabric setup, securing backends and fixing errors.
Want your own Minecraft server? Minecraft server hosting