Minecraft:Server.jar
More actions
Template:Lowercase title
Template:Exclusive
Template:Infobox program
Template:Relevant tutorial
server.jar is an executable Template:W file containing the program and resources of the Template:JE server software. It is distributed by Minecraft:Mojang Studios and can be downloaded free of charge.
Code is shared between server.jar and Minecraft:client.jar, meaning they are identical in Minecraft:gameplay. The client.jar file provides an internal server used for playing Minecraft:singleplayer worlds, but server.jar does not provide a client.
Contents
The server.jar file can be opened with a Template:W that supports ZIP files.
When ran, libraries from the contained META-INF directory are extracted into the working directory. This behavior can further be configured by a different main class available on the JAR file, see Template:Slink.
The archive also contains a Minecraft:version.json file, which provides version information.
Directory structure
Upon running the server.jar, the program generates the following files and directories:
- Template:File: The working directory of the server software process.
- Template:File: contains external libraries and JAR files required by the server software.
- Template:File: a versioned JAR file that contains the primary code and resources for the server (similar to
Minecraft:client.jar, but without client-related files, e.g. rendering code). - Template:File: Contains logs.
- Template:File: 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.
- Template:File: The most recent log. UTF-8 format, CRLF line endings on Windows, LF line endings on Linux and macOS.
- Template:File: 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.
- Template:File: Specifies IP addresses that are banned from the server. Not generated until the EULA is accepted.
- Template:File: Specifies players that are banned from the server. Not generated until the EULA is accepted.
- Template:File: Contains information about the EULA applying to the server software, as well as specifying whether the user has accepted it.
- Template:File: Specifies Minecraft:operator status of players. Not generated until the EULA is accepted.
- Template:File: Server icon that appears on the server list. Not generated automatically. Must be in PNG format and 64x64 pixels.
- Template:File: Primary server software JAR file. Can be located elsewhere, but usually placed in the same directory as the rest of the server data.
- Template:File: Preset configuration file used to configure most of the server's functionality.
- Template:File: 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 does not exist on startup, it is generated with default content and the program exits. The default content is as follows:
<syntaxhighlight lang="properties">
- By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
- [Generation time]
eula=false </syntaxhighlight>
Much like server.properties, it follows the Template:W 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 basic Template:W.
The command-line interface outputs logs to the Template:W, and accepts newline delimited input from the Template:W, which is executed by the server as Minecraft:commands (similar to being executed by Minecraft: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 or nogui option is not provided. It is written in Template:W (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
<section begin="command-line-options"/>
| Option | Description |
|---|---|
--bonusChest |
Enable the Minecraft:bonus chest when generating a world for the first time. |
--demo |
Enable Minecraft: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 Minecraft: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 Minecraft:World Options on the client. |
--help |
Print available options without starting the server. |
--initSettings |
Initialize Minecraft:server.properties and eula.txt without starting the server. If either file is missing, it creates them with default values.
|
--jfrProfile |
Initialize Template:W 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 Template:Slink.
|
--nogui |
Disable the GUI when launching the server. |
nogui |
Legacy alias of --nogui.
|
--pidFile <path> |
Create a text file at path containing the Template:W (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 fresh and defragmented region files.<ref>Template:Cite</ref> 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 Minecraft:data pack. |
--serverId <id> |
Specify the "Server Id" string used in the Minecraft: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.
|
<section end="command-line-options"/>
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:<ref>Template:Cite</ref>
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 Template:Tpl.net.minecraft.gametest.Main: Used as an entry point for the Minecraft:GameTest framework, which provides its own command-line options.<ref>Template:Cite</ref>- 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 Template:Cd and Template:Cd 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. Template:Nowrap is a valid execution.
History
Issues
References
<references/>
See also
- Minecraft:Bedrock Dedicated Server, the server software used to host a Template:BE server.
- Minecraft:client.jar, the program and resources for the Minecraft: Java Edition game.
Template:Navbox Java Edition technical
Minecraft:de:server.jar Minecraft:fr:server.jar Minecraft:ja:Server.jar Minecraft:pt:Server.jar Minecraft:zh:服务端核心文件