← All guides

Minecraft Server Closes Right After Starting? Common Startup Errors

Updated November 29, 2026 · 6 min read

You run the start script, a window flashes for half a second and disappears. Or the console prints a few lines and stops. This is one of the most common problems on a brand new server, and nearly always it's one of five things. The trick is getting the window to stay open long enough to read the error.

Short answer
First make the error visible: add pause at the end of start.bat on Windows, or run the script from a terminal. Then match the message. "You need to agree to the EULA" means set eula=true in eula.txt. UnsupportedClassVersionError means your Java is too old. "Unable to access jarfile" means the file name in the script is wrong. Heap or memory errors mean your -Xmx is too high or you're on 32-bit Java.

This guide is for vanilla, Paper, Spigot and Purpur. If you're running a modpack, the causes are different, so see Forge server won't start instead.

Step 1: See the actual error

On Windows, if you double-click start.bat and the window vanishes, edit the file and add pause on a new line at the end:

java -Xms4G -Xmx4G -jar server.jar --nogui
pause

Now the window stays open after the server stops, and you can read the last lines.

On macOS or Linux, open a terminal, cd into the server folder and run the script there (./start.sh or sh start.sh). The output stays on screen.

On a hosted server, look at the console in your panel, or open logs/latest.log. A panel message like "exited with code 1" is just the summary. Scroll up for the reason. More on reading logs in where to find server logs.

Now match what you see to one of the sections below.

"You need to agree to the EULA"

You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

This is the most common one, and it's not really an error. The first time a server runs, it creates eula.txt and stops on purpose. Open that file in the server folder. You'll see:

eula=false

Change it to:

eula=true

Save, and start the server again. By doing that you're agreeing to Mojang's EULA, which is linked in the file. You only need to do this once per server folder.

If you've already done this and it still says the same thing, check that you edited the eula.txt in the same folder the server runs from, and that your editor didn't save it as eula.txt.txt (Windows hides extensions by default).

UnsupportedClassVersionError: wrong Java version

java.lang.UnsupportedClassVersionError: ... has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

The server jar needs a newer Java than the one you're running. The class file numbers tell you which:

Class file version Java version
61 Java 17
65 Java 21
69 Java 25

And the Java each Minecraft version needs:

Minecraft version Java
1.18 to 1.20.4 Java 17
1.20.5 to 1.21.x Java 21
26.1 and newer Java 25

Install the right version, then make sure the script actually uses it. If you have several Java versions installed, java might point at an old one. Run java -version to check, or put the full path to the right Java in your start script. Full details in which Java version your server needs.

The opposite problem can happen too. Very old Minecraft versions sometimes fail on very new Java. If you're running something like 1.12.2, use Java 8.

"Error: Unable to access jarfile"

Error: Unable to access jarfile server.jar

Java can't find the jar named in your script. Usually:

Memory and heap errors

Invalid maximum heap size: -Xmx16G
Error: Could not create the Java Virtual Machine.

or

Error occurred during initialization of VM
Could not reserve enough space for 4194304KB object heap

These mean Java can't get the memory you asked for. Common causes:

For picking the right number, see how much RAM a server needs. For good flags to go with it, see Aikar's flags explained. If the server starts fine but dies later with OutOfMemoryError, that's a different problem covered in out of memory crash fixes.

"Failed to bind to port"

**** FAILED TO BIND TO PORT!
Perhaps a server is already running on that port?

Another program, often a second copy of your own server, is already using the port. Close it, or change server-port in server.properties. Full fix in port 25565 explained.

A damaged world

If the server gets most of the way through startup and then stops while loading the world, with errors mentioning level.dat or a region file, the world may be damaged. This usually happens after a power cut or a server that was killed instead of stopped.

Minecraft keeps a spare copy of the main world file. Stop the server, go into the world folder, rename level.dat to level.dat.broken, then make a copy of level.dat_old and name it level.dat. Start again.

If that doesn't work, restore the world from a backup. Copy the world folder somewhere safe before trying anything, so you can't make it worse. See how to back up your server.

To avoid this in future, always stop the server with the stop command instead of closing the window. If it hangs on shutdown, see server stuck on stopping.

A plugin causing trouble

On Paper and Spigot, a broken plugin usually doesn't stop the server. It shows an error, gets disabled, and the server carries on. But a plugin built for a very different Minecraft version can still throw errors that stop startup.

To test, move everything out of the plugins folder into a temporary folder and start the server. If it starts, add plugins back a few at a time until it breaks again. Then update or remove that plugin. More in how to add plugins.

Still stuck?

Copy the full latest.log (not just the last line) and post it when asking for help, along with your Minecraft version, server software and Java version. The first ERROR line and any Caused by: lines are usually where the answer is. If there's a file in crash-reports/, include that too. See how to read a crash report.

Quick checklist

  1. Add pause (Windows) or run from a terminal so you can see the error
  2. eula=true in eula.txt
  3. Right Java version, and the script actually uses it
  4. Jar name in the script matches the real file
  5. 64-bit Java, sensible -Xmx, no typos
  6. Nothing else using the port
  7. Restore level.dat_old or a backup if the world won't load

FAQ

Why does my server stop after creating a few files the first time?

That's the EULA check. On the first run the server creates eula.txt and stops. Open it, change eula=false to eula=true, save, and start again.

What does class file version 65.0 mean?

It means the jar was built for Java 21 and you're running an older Java. Version 61 is Java 17, 65 is Java 21 and 69 is Java 25. Install the Java your Minecraft version needs.

My panel just says the server exited with code 1. What does that mean?

Only that Java stopped because of an error. The real reason is a few lines higher in the console or in logs/latest.log.

Want a server that just runs fast?

FreaksMC runs on NVMe hardware with performance-tuned defaults baked in - pre-optimized Paper, sane view distances, and one-click world pre-generation. Set up in 60 seconds.

See plans from $3/mo

We use cookies for analytics & ads to measure how our site performs. Essential cookies always run. See our Privacy Policy.