8/12/2025

Here's the thing about running a Minecraft server: it’s ALL fun & games until it crashes when you’re asleep, at work, or on vacation. Nothing kills a community’s vibe faster than an offline server. Players get frustrated, momentum is lost, & you, the admin, get a flood of "is the server down?!" messages. It's a massive headache.
Honestly, a server that just runs isn't enough. You need a server that can take a punch. One that survives unexpected crashes, random server hiccups, & even full system reboots from those pesky automatic Windows updates. You need a truly resilient, 24/7 server that just… works.
Turns out, setting this up is totally doable, whether you're on Windows or Linux. It’s the difference between an amateur server & a professional one. We're going to dive deep into the exact methods the pros use to create unkillable Minecraft servers. We'll cover everything from simple scripts to powerful system services. By the end of this, your server will be an absolute tank.

The Foundation: A Rock-Solid Start Script

Before we get into the auto-restarting magic, let's make sure your basic server launch command is solid. This is the engine of your whole setup. You'll have a file, usually a
1 .bat
on Windows or a
1 .sh
on Linux, that contains the command to start your server.
The basic command looks something like this:
1 java -Xmx4G -Xms4G -jar server.jar nogui
Let's break that down:
  • 1 java
    : This just tells the system to use Java.
  • 1 -Xmx4G
    : This is SUPER important. It sets the MAXIMUM amount of RAM your server can use.
    1 4G
    means 4 Gigabytes. You should set this to a bit less than the total RAM your machine has.
  • 1 -Xms4G
    : This sets the INITIAL amount of RAM the server starts with. A pretty common pro-tip is to set the initial (
    1 -Xms
    ) & maximum (
    1 -Xmx
    ) RAM to the SAME value. This can prevent performance stutters that happen when the server has to suddenly ask the system for more RAM.
  • 1 -jar server.jar
    : This tells Java to run your main server file. Your file might be named something different, like
    1 forge-1.16.5.jar
    or
    1 paper.jar
    . Just make sure the name matches EXACTLY.
  • 1 nogui
    : This runs the server without the graphical user interface (the little status window). You should ALWAYS use this on a dedicated server. The GUI eats up unnecessary memory & CPU cycles. You'll interact with the console via the command line, which is way more efficient.
Pro-Tip: Optimized Java Flags
If you want to squeeze out a little more performance, you can add some extra flags. These tell Java how to manage memory & garbage collection more efficiently for a long-running server application.
Here's an example of a more optimized startup command:
1 java -Xmx4G -Xms4G -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:G7RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
Looks intense, right? Don't worry too much about what every single flag does. This is a well-known set of flags from Aikar, a developer in the Minecraft community, & they are widely considered to be excellent for modern Minecraft servers. Just copy, paste, & adjust your RAM allocation.

Method 1: The Unkillable Server on Windows (The Batch File Method)

For Windows users, the humble batch file (
1 .bat
) is your best friend. It’s a simple text file with some commands that the Windows Command Prompt can execute.

The Simple Auto-Restart Script

This is the most basic way to get your server to restart if it crashes.
  1. In your main server folder, right-click, go to
    1 New
    ->
    1 Text Document
    .
  2. Name it
    1 start.bat
    (make sure you change the extension from
    1 .txt
    to
    1 .bat
    ). Windows might warn you about changing the file extension; just click "Yes."
  3. Right-click
    1 start.bat
    & choose
    1 Edit
    . It will open in Notepad.
  4. Paste the following code into the file:

Copyright © Arsturn 2025