Skip to content

How to Set Up a Minecraft Java Server? Guide with Official server.jar

Set up your own Minecraft Java server on your PC using Mojang's official server software: Java 25, eula.txt, -Xmx memory allocation, server.properties, whitelist, operator, port forwarding, and security.

VeyroBot team

This article was translated automatically from the Turkish original. Read the Turkish original

How to Set Up a Minecraft Java Server? Guide with Official server.jar
In this article
  1. Requirements before installation
  2. Running the server for the first time
  3. Memory configuration: -Xms and -Xmx
  4. Important settings in the server.properties file
  5. Whitelist and operator permissions
  6. Friends connecting: local network and port forwarding
  7. Connection and startup issues
  8. Security and backups

In Short

To set up a Minecraft Java server on your own computer, you just need Java 25, Mojang's official server.jar file, and an empty folder. Run the server once, set eula=true in eula.txt, and configure your settings in the server.properties file. For your friends to connect over the internet, you need to forward port 25565. Keep online-mode enabled and the whitelist active.

Requirements before installation

This guide covers running Mojang's official (vanilla) server software on your own computer. Modded or plugin-supported server software (like Paper, Fabric, NeoForge) have their own installation steps.

  • Java 25: According to the Minecraft Wiki's 26.1 version page, Java Edition 26.1 and later require Java 25. As of October 9, 2026, the latest version is 26.3 released on September 15, 2026, which also requires Java 25. You do not need the full JDK for the server; the Java Runtime Environment (JRE) is enough.
  • Server file: Downloaded from minecraft.net's server download page. Do not download "pre-made server" files from other sites.
  • An empty folder: Upon its first run, the server creates many files and a world folder in the same directory. Choose a separate folder instead of your desktop.
  • Sufficient memory: If the server and game will run on the same computer, they will share memory. We explain the amount to allocate to the server below.

Check your installed Java version in the command line with this command:

java -version

You should see version 25 or newer in the output. A modern server started with an old Java version will shut down immediately with an error stating that the class version is not supported (UnsupportedClassVersionError).

Running the server for the first time

  1. Download the server file from minecraft.net and place it in the folder you created. The commands in this guide assume the file name is server.jar; if its name is different, either rename the file or fix the name in the command.
  2. Open a command line in the folder and start the server for the first time:

    java -jar server.jar --nogui

    The --nogui option prevents the server from opening a graphical window; if you don't use it, a small management window will open.

  3. The server will close shortly after, and the eula.txt file will be created in the folder. This is expected behavior.
  4. Open the eula.txt file with a text editor. Read the Minecraft End User License Agreement and, if you accept it, change the line to:

    eula=true
  5. Restart the server. This time, the world will be generated and a line indicating that the server is ready will appear in the console. Type stop in the console to shut down the server.

After the first run, you will find the following files in the folder: eula.txt, server.properties (server settings), ops.json (operator list), whitelist.json (whitelist), and the world folder named world by default.

Memory configuration: -Xms and -Xmx

You tell Java how much memory the server can use with two options. -Xms sets the initial memory, and -Xmx sets the maximum memory that can be used. The Minecraft Wiki's server setup guide gives this example:

java -Xms1024M -Xmx2048M -jar server.jar --nogui

This command starts the server with 1 GB and allows it to use a maximum of 2 GB. As the player count, render distance, and world size increase, the required memory also increases. If you see errors in the server console about running out of memory, gradually increase the -Xmx value.

Do not give all the computer's memory to the server. Room must also be left for the operating system and, if you are running the game on the same computer, the game client.

To avoid typing the command every time, you can create a startup script. On Windows, save a file named start.bat in the server folder:

@ECHO OFF
java -Xms1024M -Xmx2048M -jar server.jar --nogui
pause

The pause line keeps the window open after the server shuts down so you can read the output. On Linux or macOS, a shell script does the same job:

#!/bin/sh
cd "$(dirname "$0")"
exec java -Xms1024M -Xmx2048M -jar server.jar --nogui

After saving the file as start.sh, make it executable with the chmod a+x start.sh command.

Important settings in the server.properties file

server.properties sits in the folder where the server is launched and is a plain text file. You need to restart the server for changes to take effect. According to the Minecraft Wiki's server.properties page, the prominent settings and their default values are as follows:

SettingDefaultWhat it does
online-modetrueAllows only players with verified Minecraft accounts to join.
white-listtrue (in newly created files with 26.3)Only players on the whitelist can connect. Operators are automatically counted in the list.
enforce-whitelistfalseWhen enabled, players not on the list are kicked from the server when the whitelist is reloaded.
difficultyeasyDifficulty: peaceful, easy, normal, or hard.
max-players20Maximum number of players that can be connected at the same time.
motdA Minecraft ServerThe message displayed under the server name in the server list.
server-port25565The TCP port the server listens to.
gamemodesurvivalThe default game mode for players.
view-distance10The render distance the server sends to the player (in chunks).
simulation-distance10The distance at which entities are updated (in chunks).

An example configuration might look like this:

online-mode=true
white-list=true
enforce-whitelist=true
difficulty=normal
max-players=10
motd=Friends server

The pvp and enable-command-block settings seen in older guides have been removed from server.properties in recent versions. According to the Minecraft Wiki, these two are now managed as game rules. Lowering the view-distance and simulation-distance values reduces the server load, but players see a shorter distance.

Whitelist and operator permissions

Starting with version 26.3, white-list is enabled by default in newly created server.properties files. This means you won't even be able to join your newly set up server without adding yourself first. If you updated an old server, the existing value in your file is preserved.

Manage the whitelist in the server console with the following commands (slashes are not needed at the beginning of commands in the console):

whitelist add PlayerName
whitelist remove PlayerName
whitelist list
whitelist on
whitelist reload

Operators (op) are players who can use administrative commands in-game. Grant operator privileges only to yourself and people you trust:

op PlayerName
deop PlayerName

These commands update the whitelist.json and ops.json files respectively. Using commands instead of editing the files manually ensures that the player's account ID is recorded correctly.

Friends connecting: local network and port forwarding

Players on the same home network can connect using the local IP address of the server computer. On Windows, you can read this address by running ipconfig in the command line and looking at the "IPv4 Address" line. On Linux, the ip address command provides the same information.

Three steps are required for players on the internet to connect:

  1. Firewall: When the server first opens, Windows may ask for permission for Java's network access. Grant permission or add a rule in the firewall for port 25565.
  2. Static local IP: Assign a static local IP to the server computer on your router. Otherwise, the forwarding rule will fail when the address changes.
  3. Port forwarding: Forward external port 25565 to port 25565 on the server computer's local IP in your router interface. The Minecraft Wiki recommends opening the rule for both TCP and UDP together.

Then you give your friends your external IP address. If your internet service provider changes your external IP frequently, a dynamic DNS service can point a domain name to your current address at all times. Some providers bundle multiple subscribers behind the same external IP, which can prevent port forwarding from working at all. In this case, you need to contact your provider.

Connection and startup issues

Server shuts down as soon as it opens

The most common cause is leaving eula=false in the eula.txt file. Open the file and change the value to true. If there is an error in the console related to the Java version, check that Java 25 is installed and the command is using that Java.

"Timed out" error when connecting

According to the Minecraft Wiki, a timeout usually points to a firewall or port forwarding issue. Check that the rule is written to the correct local IP and that the server is open.

Connection refused

A "Connection refused" error typically indicates that the server is not running or is not listening to that port. If you changed the server-port value, update the forwarding rule to match that port as well.

I join the server, but it says I am not on the whitelist

white-list is enabled and your name is not on the list. Add yourself from the server console using the whitelist add command.

Security and backups

  • Do not set online-mode=false. When this setting is disabled, the server does not verify the player's Minecraft account. Anyone can join with any name, such as an operator's name, and use that operator's privileges. The whitelist also loses its protection since it relies on names.
  • Keep the whitelist on. It prevents unfamiliar people from joining when your server address gets shared. Players you remove from the list with enforce-whitelist are also kicked from the server.
  • Keep the number of operators low. Operator privileges allow modifying the world and banning players.
  • Make backups. Shut down the server with the stop command and copy the world folder to another disk or cloud storage. A world copied while the server is running may be inconsistent. Always take a backup before updating versions; if an issue arises with a world opened in a new version, you will have the old copy.
  • Keep the server updated. The game version of players connecting to the official server must match the server's version. When a new update comes out, take a backup first, then update the server file.

If a community is forming around your server, setting up a Discord server for communication with players makes things easier. The gaming community Discord server setup guide explains channel and role structures. For the common challenges of managing a Minecraft server and Discord together, check out the community management outside of Discord article.

Last updated: October 9, 2026. Information has been compiled from the minecraft.net server download page and the Minecraft Wiki's server.properties, server setup, and version pages; version and Java requirements are subject to change. If you manage a Discord server for your Minecraft players, VeyroBot helps you manage tasks like moderation and welcoming from a single panel.

Add the bot to your server Free · ~30s