server.jar

This feature is exclusive to Java Edition.
 
server.jar
Server.jar GUI.png: Infobox image for server.jar the program in Minecraft
Author(s)
Platform(s)

WindowsmacOSLinux and other platforms that support running a JVM

Written in

Java Java

Latest version
Release date

June 8, 2009

Size
  • Only JAR: ≈ 54 MiB
  • With initial generated data: ≈ 114 MiB
License

EULA

Source available

Partial

Links

There is a related tutorial page for this topic!
 

server.jar is an executable JAR file providing the server software used to host a Java Edition server. It is distributed by Mojang Studios and can be downloaded for free.

Code is shared between the server.jar and the client.jar, meaning they are identical in gameplay. The client.jar provides an internal server used for playing singleplayer worlds, but server.jar does not provide a client.

Contents

The server.jar contains the program and resources necessary to run a Minecraft server. When ran using JVM, these resources are extracted into the working directory. They are extracted from the META-INF folder of server.jar, which can be opened with a file archiving program that supports ZIP files. This extraction behavior can further be configured by a different main class available on the JAR file, see § Bundler options.

The server.jar also contains version.json file, which provides Java Edition version information.

Directory structure

Upon running the server.jar, the program generates the following resources:

  • File directory.png: Sprite image for directory in Minecraft working directory: The working directory of the server software process.
    • File directory.png: Sprite image for directory in Minecraft libraries: contains external libraries and JAR files required by the server software.
    • File archive.png: Sprite image for archive in Minecraft versions/<version>/server-<version>.jar: a versioned JAR file that contains the primary code and resources for the server (similar to client.jar, but without client-related files, e.g. rendering code).
    • File directory.png: Sprite image for directory in Minecraft logs: Contains logs.
      • File file.png: Sprite image for file in Minecraft YYYY-MM-DD-ordinal.log.gz: Rotated older log. There might be any number of these files depending on how many times the log was rotated. Same format as latest.log, but compressed with gzip.
      • File file.png: Sprite image for file in Minecraft latest.log: The most recent log. UTF-8 format, LF line endings on Linux, CRLF on Windows.
    • File directory.png: Sprite image for directory in Minecraft world: World data directory. Can have different name or location if the default value in server.properties is changed. Not generated until the EULA is accepted.
    • File file.png: Sprite image for file in Minecraft banned-ips.json: Specifies IP addresses that are banned. Not generated until the EULA is accepted.
    • File file.png: Sprite image for file in Minecraft banned-players.json: Specifies players that are banned. Not generated until the EULA is accepted.
    • File file.png: Sprite image for file in Minecraft eula.txt: Contains information about the EULA applying to the server software, as well as specifying whether the user has accepted it.
    • File file.png: Sprite image for file in Minecraft ops.json: Specifies OP status of players. Not generated until the EULA is accepted.
    • File file.png: Sprite image for file in Minecraft server-icon.png: Server icon that appears on the server list. Not generated automatically. Must be in PNG format and 64x64 pixels.
    • File archive.png: Sprite image for archive in Minecraft server.jar: Primary server software JAR file. Can be located elsewhere, but usually placed in the same directory as the rest of the server data.
    • File file.png: Sprite image for file in Minecraft server.properties: Preset configuration file used to configure most of the server's functionality.
    • File file.png: Sprite image for file in Minecraft whitelist.json: Specifies players that are whitelisted. Not generated until the EULA is accepted.

Files are generated on the first run if not mentioned otherwise.

eula.txt

If an eula.txt file doesn't exist on startup, it is generated with default content and the program exits. The default content is as follows:

#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
#[Generation time]
eula=false

Much like server.properties, it follows the .properties syntax. eula has to be set to true for the server to start.

Interface

The server software has both a command line interface and a rudimentary GUI.

The command-line interface outputs logs to the standard output, and accepts newline delimited input from the standard input, which is executed by the server as commands (similar to being executed by command blocks, but with the highest privilege level). Running a command in the interface does not require / at the beginning of the line.

The GUI appears if the platform supports windowing and the --nogui option is not provided. It is written in Abstract Window Toolkit (AWT), and it features three sections:

  • "Stats" which displays memory usage as a graph and as a value, and average tick time,
  • "Players" which displays a player list, and
  • "Log and chat" which displays logs and serves the same function as the command-line interface.

Command-line options

Option Description
--bonusChest Enable the bonus chest when generating a world for the first time.
--demo Enable demo mode. Shows the players a demo pop-up, and players cannot break or place blocks after the 5 in-game days demo time has expired, even if they have purchased the game.
--eraseCache Erase cached data like light levels and biome data, which must then be regenerated. Equivalent to the "Erase Cached Data" option of "Optimize World" in World Options on the client.
--forceUpgrade Optimize the world by upgrading the level data to the latest format. Once the world is optimized, it is no longer compatible with older level formats. Equivalent to the "Optimize World" option in World Options on the client.
--help Print available options without starting the server.
--initSettings Initialize server.properties and eula.txt without starting the server. If either file is missing, it creates them with default values.
--jfrProfile Initialize Java Flight Recorder profiler for the server. While the server is running, the profiler can be opened using an external tool or software, such as VisualVM. It enables monitoring of the server's CPU, memory, and threads usage. Additionally, it saves a jfr file on the debug folder of the server.jar, containing JVM and operating system events, and several Minecraft-related custom events. Further information on Commands/jfr § Usage.
--nogui Disable GUI when launching the server.
nogui Legacy alias of --nogui.
--pidFile <path> Create a text file at path containing the process identifier (PID) of the server process while it's running.
--port <port> Specify the TCP port to use instead of the value in server.properties.
--recreateRegionFiles Optimize the world similar to --forceUpgrade, but also rewrites all the chunks independently of whether they have been upgraded, creating a fresh and defragmented region files.[1] Using this option after changing region-file-compression in server.properties will recompress all region files in the new format.
--safeMode Ensure the server only loads the vanilla datapack.
--serverId <id> Specify the "Server Id" string used in the crash report details.
--universe <path> Specify the path to the directory level-name in server.properties is relative to. If empty, it is relative to the working directory.
--world <name> Specify the world name to use instead of the level-name value in server.properties.

Bundler options

The server.jar introduces an extra layer of code (called the "bundler") for extracting runtime libraries. This allows the main class to be specified at startup using system properties.

The following system properties can change the startup behavior:[2]

  • bundlerMainClass: Specifies the main class to start. If not specified, the main class defined on META-INF/main-class file in the server.jar (usually net.minecraft.server.Main) is used instead. There are three available main classes:
    • net.minecraft.server.Main: Used for launching the Minecraft server.
    • net.minecraft.data.Main: Used as entry point for data generators.
    • net.minecraft.gametest.Main: Used as an entry point for the GameTest framework, which provides its own command-line options.[3]
    • Unspecified: If no option is specified or an empty blank string ("") is entered, it results in Empty main class specified, exiting.
Before executing the main class, the JAR file automatically extracts libraries and versions folders, even for unspecified option.
  • bundlerRepoDir: Specifies the working directory for the resources extraction. If not specified, the current working directory is used instead.

System properties are specified like -D<property>, which property is the name defined above. They must be specified for the JVM program in the command-line, placed before -jar parameter (otherwise it will be specified for the server.jar file, which is invalid), e.g. java -DbundlerMainClass="net.minecraft.data.Main" -jar server.jar is a valid execution.

History

For general multiplayer server history, see Multiplayer § History.
Java Edition Alpha
1.0.15server.jar was released to the public, alongside Survival multiplayer servers.
Java Edition
1.0.1server.jar was updated in a server-only release.
Fixed Invalid server key error when logging in.
Fixed Null pointer exception error when logging in.
1.3.112w18aThe server logic was separated from the client, making singleplayer effectively run an internal server.
Added command-line arguments: --demo, --port, --singleplayer, --universe, and --world. The legacy nogui argument remained functional.
12w19aAdded the --bonusChest command-line argument.
12w21aRemoved server.jar dependency in singleplayer.
1.1620w20bThe dedicated server main class was changed from net.minecraft.server.MinecraftServer to net.minecraft.server.Main.
20w22aAdded the --safeMode command-line argument.
1.1821w37aAdded the --jfrProfile command-line argument.
21w39aChanged the file structure of server.jar. Individual libraries are now bundled separately instead of being merged into a single archive.
Server startup now unpacks libraries into a directory configured by the bundlerRepoDir property (defaults to the working directory).
The main class can be changed using the bundlerMainClass property.
1.18-pre3Starting server.jar with an empty bundlerMainClass property now validates and extracts files, then exits.
1.2023w06aAdded the --pidFile command-line argument.
1.20.223w31aRemoved the --singleplayer command-line argument.
1.20.524w04aAdded the --recreateRegionFiles command-line argument.
Added the region-file-compression setting to server.properties.
1.21.424w45aThe data generator entry point (net.minecraft.data.Main) no longer generates the assets directory.
The --client command-line option was removed for the data generator entry point.
1.21.525w03aAdded the net.minecraft.gametest.Main entry point for running automated game tests from server.jar.
Added associated command-line arguments for the gametest entry point: --help, --packs, --report, --tests, --universe, and --verify.

Issues

Issues relating to "Server.jar", "Server jar", or "Java server" are maintained on the bug tracker. Issues should be reported and viewed there.

References

  1. "Minecraft Snapshot 24w04a" (§ Region file compression algorithm) by Java Team – Minecraft.net, January 24, 2024.
  2. "Minecraft Snapshot 21w39a" (§ Server bundling) by Adrian Östergård – Minecraft.net, September 29, 2021.
  3. "Minecraft Snapshot 25w03a" (§ Technical Changes) – Minecraft.net, January 15, 2025.

See also

Navigation