Skip to content
Minecraft
Free tool

Minecraft start.bat & start.sh Generator – Startup script for your server

With this startup script generator for Minecraft servers, you can create a start.bat for Windows, a start.sh for Linux/macOS, or just the Java startup command in a few clicks. Set RAM with a slider, choose Aikar's Flags or Velocity flags, and configure --nogui and auto-restart. It's free, with no sign-up: the script is generated right in your browser, ready to copy or download.

Built by Luca Stanek

Script ready? Skip the setup and run it on a managed server.

1 GB32 GB

Your startup script (start.sh)

#!/bin/bash
cd "$(dirname "$0")"

while true; do
  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 server.jar --nogui
  echo "Server stopped with code $? - restarting in 5 seconds..."
  sleep 5
done

Example result

What the Start Script Generator creates

You choose a platform, RAM, flags, and jar file. The generator instantly provides a ready-to-use startup script or a single Java command to copy. The values below are an example for a Paper server on Linux.

Example · paper.jar · 6 GB · Aikar's Flags

Platform
Linuxstart.sh
RAM
6GB
Flags
Aikar's
Auto-restart
On

Output

start.sh
#!/bin/bashcd "$(dirname "$0")" while true; do  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  echo "Server stopped with code $? - restarting in 5 seconds..."  sleep 5done
  • -Xms6G -Xmx6GThe same value for initial and maximum RAM: the server reserves the memory once and does not need to increase it later.
  • -XX:+UseG1GC …Aikar's Flags: a proven set of garbage collection settings that reduces lag spikes on Paper, Purpur, and Spigot servers.
  • while true; do …Auto-restart: If the server crashes or is stopped with /stop, the script restarts it after 5 seconds.

Why this generator

More than a simple text field

Preconfigured instead of pieced together yourself.

Aikar's & Velocity Flags

Add Aikar's Flags for Paper/Purpur/Spigot or Velocity flags for the proxy with one click. Above 12 GB of RAM, the generator automatically adjusts Aikar's Flags.

Linux & Windows

Generates either a start.sh for Linux/macOS or a start.bat for Windows. Without auto-restart, start.bat ends with pause so error messages remain readable.

RAM slider with Xms=Xmx

Choose 1 to 32 GB of RAM with the slider. The command automatically sets -Xms and -Xmx to the same value.

Auto-restart loop

Optional restart loop: after a crash or /stop, the script restarts the server after 5 seconds.

Command only

Don't need a script? You can also paste the plain Java command directly into a panel.

Copy or download

Free and no sign-up required: the result is generated directly in your browser. Copy it with one click or download it as start.bat or start.sh.

How it works

How to create your start.bat or start.sh

From configuration to your Minecraft server's first launch.

Step 1

Choose output

Under “Output”, choose a startup script for Linux/macOS (start.sh), a startup script for Windows (start.bat), or just the Java command for a console or panel.

Step 2

Select flags preset

Choose no flags, Aikar's Flags for Paper, Purpur, and Spigot, or Velocity flags for the Velocity proxy.

Step 3

Enter Java command and JAR file

The defaults are java and server.jar. Enter the exact name of your server JAR and, if needed, the full path to a specific Java installation.

Step 4

Set RAM

Use the slider to choose between 1 and 32 GB of memory. -Xms and -Xmx automatically get the same value.

Step 5

Choose options

Enable or disable --nogui and automatic restart after a crash. --nogui isn't available with Velocity flags, and auto-restart is only available for scripts.

Step 6

Copy or download

The preview updates instantly whenever you make a change. Copy the result to your clipboard or download start.bat or start.sh as a file.

Step 7

Start a Minecraft server

Place the file in the same directory as the server JAR. Double-click start.bat to run it; for start.sh, run chmod +x start.sh first, then ./start.sh. The script only starts the JAR file; you need to accept the EULA in eula.txt yourself on the first launch.

Windows & Linux

start.bat or start.sh: How to start your Minecraft server

Both scripts run the same Java command; only the surrounding script syntax differs: start.bat is for Windows, while start.sh is for Linux and macOS. Since both first switch to their own directory, it's best to place the file right next to your server JAR.

@echo off · cd /d "%~dp0"
Start of start.bat: hides command output and switches to the directory containing the file.
pause
Without auto-restart, start.bat ends with pause. This keeps the console window open after a crash so you can read the error message.
#!/bin/bash · cd "$(dirname "$0")"
Start of start.sh: runs the script with Bash and switches to the directory containing the file.
chmod +x start.sh
On Linux and macOS, make start.sh executable once, then run it with ./start.sh.

Flags presets

Aikar's Flags, Velocity flags, or no flags?

The flags preset determines which JVM flags appear between the RAM settings and -jar in the command. The right choice depends on what you're starting.

No flags
The command contains only -Xms, -Xmx, -jar, and optionally --nogui. Useful if you want to start without additional JVM tuning or add your own flags.
Aikar's Flags
G1 garbage collection flags from the Paper community for Paper, Purpur, and Spigot servers, intended to reduce lag spikes caused by garbage collection. Above 12 GB of RAM, the generator automatically changes five values to those recommended for large heaps, such as G1HeapRegionSize=16M instead of 8M.
Velocity flags
A smaller set of flags for the Velocity proxy, not the game server. This preset omits --nogui because Velocity doesn't recognize that argument.

Startup command

Minecraft startup command explained: -Xms, -Xmx, and --nogui

For 6 GB of RAM, the JAR file paper.jar, and no additional flags, the generator produces this command:

java -Xms6G -Xmx6G -jar paper.jar --nogui
-Xms · -Xmx
Initial and maximum memory for Java. The generator sets both to the slider value (1 to 32 GB) so Java reserves the full heap size at startup.
-jar
Next comes the name of your server JAR, such as paper.jar or server.jar. If the name or Java path contains spaces, the generator automatically puts it in quotation marks.
--nogui
Starts the server without the graphical server window, using only the console.
Command only
This output provides just the command line, without a surrounding script, to paste into a console or panel. Download and auto-restart aren't available in this mode.

How much RAM your server needs depends on plugins, Mods, and player count. Go to the Minecraft RAM calculator

Explore more

After the startup script: More Minecraft tools

FAQ

Frequently asked questions about the startup script generator

Quick answers about start.bat and start.sh, Aikar's Flags, RAM, and auto-restart.

Under “Output”, select “Startup script (Windows, .bat)”, set the RAM, flags, and your server JAR name, then download start.bat. The generator puts @echo off and cd /d "%~dp0" at the beginning so the script always runs from its own directory. Place the file next to the server JAR and double-click it to run it.

start.bat is for Windows, while start.sh is for Linux and macOS. Both contain the same Java command; only the surrounding script syntax differs: start.bat begins with @echo off and cd /d "%~dp0", while start.sh begins with #!/bin/bash and cd "$(dirname "$0")". Make start.sh executable with chmod +x start.sh, then run it with ./start.sh.

Aikar's Flags are G1 garbage collection flags from the Paper community for Paper, Purpur, and Spigot servers, designed to reduce lag spikes. Above 12 GB of RAM, the generator automatically changes five values to those recommended for large heaps. Velocity flags are a smaller set for the Velocity proxy only, not the game server, and omit --nogui. With “None”, the command contains only RAM settings, -jar, and optionally --nogui.

Set the memory with the slider (1 to 32 GB) and replace your old startup file with the new one. The generator sets -Xms and -Xmx to the same value so Java reserves the full heap size at startup instead of expanding it later. How much RAM your server needs depends on plugins, Mods, and player count. The Minecraft RAM calculator can give you a recommendation. Go to the Minecraft RAM calculator

Without auto-restart, the generator adds pause to the end of start.bat. The console window then stays open after the server stops or crashes so you can read the error message. For example, check that the name in the “Server JAR file” field exactly matches your file.

Only if you enable “Automatically restart after a crash”. The Java command then runs in a loop: using goto start and timeout /t 5 in start.bat, or while true and sleep 5 in start.sh. The server restarts after 5 seconds, including after /stop. This option is available only for scripts, not “Command only”.

Yes. In the “Java command” field, enter the full path to the Java installation you want instead of java. The generator automatically puts paths with spaces in quotation marks, as well as JAR names with spaces.

The script starts your server with java and -jar, so it works for servers launched from a JAR file, such as Vanilla, Paper, or Fabric. Enter the appropriate JAR name. For Forge, this only applies if your server also starts with java -jar. Aikar's Flags are designed for Paper, Purpur, and Spigot. The generator doesn't support Bedrock servers; it produces Java commands only.

Any more questions about your server?

Contact Support
Minecraft Server ListSurvival, SMP, Skyblock, Modpacks and more – with live player counts and vote rankings.
Don't want to tune flags?

Host your own Minecraft server in 60 seconds

Suitable JVM flags, DDoS protection, and Modpacks installed with a click—we handle the fine-tuning so you can play.

4.4/5 Trustpilot32,000+ Active serversSince 2010

No setup. No risk. Online in seconds.

Flexible TermCancel anytimeOnline in 60 seconds

Looking for more tools? View all Minecraft tools