server.jar

| Author(s) | |
|---|---|
| Platform(s) | |
| Written in | |
| Latest version |
|
| Release date |
June 8, 2009 |
| Size |
|
| License | |
| Source available |
Partial |
| Links |
|
{
"title": "server.jar",
"rows": [
{
"field": "\n* (link to File:Mojang Studios logo.svg article, displayed as x20px|link=Mojang Studios) (link to Mojang Studios article, displayed as Mojang Studios)",
"label": "Author(s)"
},
{
"field": "(link to File:Windows.svg article, displayed as x20px|Windows|link=wikipedia:Microsoft Windows)<span style=\"padding-left:4px\">(link to File:macOS.svg article, displayed as x10px|macOS|link=wikipedia:macOS|class=darkmode-invert)</span><span style=\"padding-left:4px\">(link to File:Tux.svg article, displayed as x20px|Linux|link=wikipedia:Linux)</span> and other platforms that support running a JVM",
"label": "Platform(s)"
},
{
"field": "(link to File:Java.svg article, displayed as x20px|Java|link=wikipedia:Java (programming language)) (link to wikipedia:Java (programming language) article, displayed as Java)",
"label": "Written in"
},
{
"field": "\n* '''Release''': (link to Java Edition_1.21.8 article, displayed as 1.21.8)",
"label": "Latest version"
},
{
"field": "June 8, 2009",
"label": "Release date"
},
{
"field": "\n* Only JAR: ≈ 54 MiB\n* With initial generated data: ≈ 114 MiB",
"label": "Size"
},
{
"field": "[https://www.minecraft.net/en-us/eula EULA]",
"label": "License"
},
{
"field": "Partial",
"label": "<span style=\"white-space:normal\">Source available</span>"
},
{
"field": "\n* [https://www.minecraft.net/en-us/download/server Website]",
"label": "Links"
}
],
"invimages": [],
"images": [
"Server.jar GUI.png"
]
}
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:
working directory: The working directory of the server software process.
libraries: contains external libraries and JAR files required by the server software.
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).
logs: Contains logs.
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.
latest.log: The most recent log. UTF-8 format, LF line endings on Linux, CRLF on Windows.
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.
banned-ips.json: Specifies IP addresses that are banned. Not generated until the EULA is accepted.
banned-players.json: Specifies players that are banned. Not generated until the EULA is accepted.
eula.txt: Contains information about the EULA applying to the server software, as well as specifying whether the user has accepted it.
ops.json: Specifies OP status of players. Not generated until the EULA is accepted.
server-icon.png: Server icon that appears on the server list. Not generated automatically. Must be in PNG format and 64x64 pixels.
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.
server.properties: Preset configuration file used to configure most of the server's functionality.
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 onMETA-INF/main-classfile in theserver.jar(usuallynet.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 inEmpty main class specified, exiting.
- Before executing the main class, the JAR file automatically extracts
librariesandversionsfolders, 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
| Java Edition Alpha | |||||||
|---|---|---|---|---|---|---|---|
| 1.0.15 | server.jar was released to the public, alongside Survival multiplayer servers. | ||||||
| Java Edition | |||||||
| 1.0.1 | server.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.1 | 12w18a | The 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. | |||||||
| 12w19a | Added the --bonusChest command-line argument. | ||||||
| 12w21a | Removed server.jar dependency in singleplayer. | ||||||
| 1.16 | 20w20b | The dedicated server main class was changed from net.minecraft.server.MinecraftServer to net.minecraft.server.Main. | |||||
| 20w22a | Added the --safeMode command-line argument. | ||||||
| 1.18 | 21w37a | Added the --jfrProfile command-line argument. | |||||
| 21w39a | Changed 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-pre3 | Starting server.jar with an empty bundlerMainClass property now validates and extracts files, then exits. | ||||||
| 1.20 | 23w06a | Added the --pidFile command-line argument. | |||||
| 1.20.2 | 23w31a | Removed the --singleplayer command-line argument. | |||||
| 1.20.5 | 24w04a | Added the --recreateRegionFiles command-line argument.
| |||||
Added the region-file-compression setting to server.properties. | |||||||
| 1.21.4 | 24w45a | The 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.5 | 25w03a | Added 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
- ↑ "Minecraft Snapshot 24w04a" (§ Region file compression algorithm) by Java Team – Minecraft.net, January 24, 2024.
- ↑ "Minecraft Snapshot 21w39a" (§ Server bundling) by Adrian Östergård – Minecraft.net, September 29, 2021.
- ↑ "Minecraft Snapshot 25w03a" (§ Technical Changes) – Minecraft.net, January 15, 2025.
See also
- Bedrock Dedicated Server, the server software used to host a Bedrock Edition server.
- client.jar, the program and resources for the Minecraft: Java Edition game.
| |||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||