Minecraft:Server.jar: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{Lowercase title}} | ||
{{ | {{Exclusive|Java}} | ||
{{Infobox program | {{Infobox program | ||
| group1 = GUI | | group1 = GUI | ||
| Line 8: | Line 8: | ||
| title = server.jar | | title = server.jar | ||
| author = | | author = | ||
* [[File:Mojang Studios logo.svg|x20px|link=Mojang Studios]] Mojang Studios | * [[File:Mojang Studios logo.svg|x20px|link=Mojang Studios]] [[Minecraft:Mojang Studios]] | ||
| platform = {{ | | platform = {{OS|win|mac|lin}} and other platforms that support running a JVM | ||
| programming language = {{ | | programming language = {{OS|java}} {{w|Java (programming language)|Java}} | ||
| price = Free | | price = Free | ||
| license = [https://www.minecraft.net/en-us/eula EULA] | | license = [https://www.minecraft.net/en-us/eula EULA] | ||
| Line 19: | Line 19: | ||
* With initial generated data: ≈ 114 MiB | * With initial generated data: ≈ 114 MiB | ||
| version = | | version = | ||
* '''Release''': {{ | * '''Release''': {{v|java}} | ||
{{#if: {{ | {{#if: {{v|java-snap}} | * '''Snapshot''': {{v|java-snap}} }} | ||
| date = June 8, 2009 | | date = June 8, 2009 | ||
| customlinks = | | customlinks = | ||
'''Downloads''' | '''Downloads''' | ||
* [https://piston-data.mojang.com/v1/objects/{{#dpl:title=Java Edition {{ | * [https://piston-data.mojang.com/v1/objects/{{#dpl:title=Java Edition {{v|java|nolink=yes}}|includepage={Infobox version}:clienthash}}/server.jar {{v|java|nolink=yes}}] | ||
* [https://piston-data.mojang.com/v1/objects/{{#dpl:title=Java Edition {{ | * {{#if: {{v|java-snap}} | [https://piston-data.mojang.com/v1/objects/{{#dpl:title=Java Edition {{v|java-snap|nolink=yes}}|includepage={Infobox version}:clienthash}}/server.jar {{v|java-snap|nolink=yes}}] }} | ||
}} | }} | ||
{{ | {{relevant tutorial|Setting up a Java Edition server}} | ||
<code>'''server.jar'''</code> is an executable {{ | <code>'''server.jar'''</code> is an executable {{w|JAR (file format)|JAR}} file containing the program and resources of the {{JE}} server software. It is distributed by [[Minecraft:Mojang Studios]] and can be downloaded free of charge. | ||
== Contents == | == Contents == | ||
The <code>server.jar</code> file can be opened with a {{ | The <code>server.jar</code> file can be opened with a {{w|file archiving program}} that supports ZIP files. It contains the program and default resources shared with the <code>[[Minecraft:client.jar]]</code>, but excluding client-specific code, like [[Minecraft:rendering]] and [[Minecraft:audio]] output, [[Minecraft:GUI]], [[Minecraft:model]]s, and others; both are identical in [[Minecraft:gameplay]]. It is intended to host a dedicated environment for [[Minecraft:multiplayer]], being able to launch a [[Minecraft:w:Headless software|headless]]<ref group="fn">On a headless environment without a graphical interface; if present, the <code>server.jar</code> will launch with a basic GUI by default, but can be disabled with <code>--nogui</code> option.</ref> version of the game. The <code>client.jar</code> file also provides an internal server used for playing [[Minecraft:singleplayer]] worlds that can be opened into [[Minecraft:LAN]]. | ||
The archive also contains a <code>[[Minecraft:version.json]]</code> file, which provides the game's version information, including the version ID (e.g., {{v|java|link=none}}), [[Minecraft:data version]], [[Minecraft:pack version]], [[Minecraft:protocol version]], and others. | |||
=== <span class="anchor" id="Directory structure"></span>Generated server directory === | |||
Upon running the <code>server.jar</code>, libraries from the contained <code>META-INF</code> directory are extracted into the working directory. This behavior can further be configured by a different main class available on the JAR file, see {{slink||Bundler options}}. | |||
Upon running the <code>server.jar</code>, the | |||
The following contents are generated by default when no option is specified: | |||
: ''"*" marks a file that is not generated until the EULA (in <code>eula.txt</code>) is accepted.'' | |||
<div class="treeview"> | <div class="treeview"> | ||
* {{File|directory|''working directory''}}: The working directory of the server software process. | * {{File|directory|''working directory''}}: The working directory of the server software process. | ||
** {{File|directory|libraries}}: contains external libraries and JAR files required by the server software. | ** {{File|directory|libraries}}: contains external libraries and JAR files required by the server software. | ||
** {{File|archive|versions/''<version>''/server-''<version>''.jar}}: a versioned JAR file that contains the | ** {{File|archive|versions/''<version>''/server-''<version>''.jar}}: a versioned JAR file that directly contains the game's code and resources (similar to <code>[[Minecraft:client.jar]]</code> without client-related files). | ||
** {{File|directory|logs}}: Contains logs. | ** {{File|directory|logs}}: Contains logs. | ||
*** {{File|file|''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|''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|latest.log}}: The most recent log. UTF-8 format | *** {{File|file|latest.log}}: The most recent log. UTF-8 format with CRLF line endings on Windows or LF line endings on Linux and macOS. | ||
** {{File|directory|world}}: World data directory. | ** {{File|directory|world}}*: [[Minecraft:Java Edition level format|World data]] directory. The name can be specified in <code>server.properties</code> by <code>level-name</code> option. | ||
** {{File|file|banned-ips.json}}: Specifies IP addresses that are banned from the server | ** {{File|file|banned-ips.json}}*: Specifies IP addresses that are banned from the server. | ||
** {{File|file|banned-players.json}}: Specifies players that are banned from the server | ** {{File|file|banned-players.json}}*: Specifies players that are banned from the server. | ||
** {{File|file|eula.txt}}: Contains information about the EULA applying to the server software, as well as specifying whether the user has accepted it. | ** {{File|file|eula.txt}}: Contains information about the EULA applying to the server software, as well as specifying whether the user has accepted it. | ||
** {{File|file|ops.json}}: Specifies operator status of players | ** {{File|file|[[Minecraft:ops.json]]}}*: Specifies [[Minecraft:operator]] status of players. | ||
** {{File|file|server-icon.png}}: Server icon | ** {{File|file|server-icon.png}}: Server icon in {{w|PNG}} file format with 64×64 pixels resolution, which appears for the client in their [[Minecraft:server list]]. Not generated automatically. | ||
** {{File|archive|server.jar}}: | ** {{File|archive|server.jar}}: The server software JAR file, used to setup the working directory, and starting up the server. It must be placed in the same directory as the rest of the server files. | ||
** {{File|file|[[Minecraft:server.properties]]}}: Preset configuration file used to configure most of the server's functionality. | ** {{File|file|[[Minecraft:server.properties]]}}: Preset configuration file used to configure most of the server's functionality. | ||
** {{File|file|whitelist.json}}: Specifies players that are whitelisted | ** {{File|file|[[Minecraft:whitelist.json]]}}*: Specifies players that are whitelisted. | ||
</div> | </div> | ||
Files are generated on the first run if not | Files are generated on the first run if not present in the same directory as <code>server.jar</code>. | ||
=== eula.txt === | === eula.txt === | ||
| Line 74: | Line 72: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Much like <code>server.properties</code>, it follows the {{ | Much like <code>server.properties</code>, it follows the {{w|.properties}} syntax. <code>eula</code> has to be set to <code>true</code> for the server to start. | ||
== Interface == | == Interface == | ||
The server software has both a command-line interface and a basic {{ | The server software has both a command-line interface and a basic {{w|graphical user interface}}. | ||
The command-line interface outputs logs to the {{ | The command-line interface outputs logs to the {{w|standard output}}, and accepts newline delimited input from the {{w|standard input}}, which is executed by the server as [[Minecraft:commands]] (similar to being executed by [[Minecraft:command block]]s, but with the highest privilege level). Running a command in the interface does not require <code>/</code> at the beginning of the line. | ||
The GUI appears if the platform supports windowing and the <code>--nogui</code> or <code>nogui</code> option is not provided. It is written in {{ | The GUI appears if the platform supports windowing and the <code>--nogui</code> or <code>nogui</code> option is not provided. It is written in {{w|Abstract Window Toolkit}} (AWT) and features three sections: | ||
* "Stats" which displays memory usage | * "Stats" which displays memory usage (graph and number percentage) and average tick time, | ||
* "Players" which displays a player list, and | * "Players" which displays a player list, and | ||
* "Log and chat" which displays logs and serves the same function as the command-line interface. | * "Log and chat" which displays logs and serves the same function as the command-line interface. | ||
| Line 93: | Line 91: | ||
! Option !! Description | ! Option !! Description | ||
|- | |- | ||
| <code>'''--bonusChest'''</code> || Enable the bonus chest when generating a world for the first time. | | <code>'''--bonusChest'''</code> || Enable the [[Minecraft:bonus chest]] when generating a world for the first time. | ||
|- | |- | ||
| <code>'''--demo'''</code> || 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. | | <code>'''--demo'''</code> || 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. | ||
|- | |- | ||
| <code>'''--eraseCache'''</code> || 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. | | <code>'''--eraseCache'''</code> || 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. | ||
|- | |- | ||
| <code>'''--forceUpgrade'''</code> || 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. | | <code>'''--forceUpgrade'''</code> || Optimize the world by upgrading the level data to the [[Minecraft:Java Edition level format|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. | ||
|- | |- | ||
| <code>'''--help'''</code> || Print available options without starting the server. | | <code>'''--help'''</code> || Print available options without starting the server. | ||
| Line 105: | Line 103: | ||
| <code>'''--initSettings'''</code> || Initialize <code>[[Minecraft:server.properties]]</code> and <code>eula.txt</code> without starting the server. If either file is missing, it creates them with default values. | | <code>'''--initSettings'''</code> || Initialize <code>[[Minecraft:server.properties]]</code> and <code>eula.txt</code> without starting the server. If either file is missing, it creates them with default values. | ||
|- | |- | ||
| <code>'''--jfrProfile'''</code> || Initialize {{ | | <code>'''--jfrProfile'''</code> || Initialize {{w|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 [https://visualvm.github.io/ VisualVM]. It enables monitoring of the server's CPU, memory, and threads usage. Additionally, it saves a <code>jfr</code> file on the <code>debug</code> folder of the <code>server.jar</code>, containing JVM and operating system events, and several ''Minecraft''-related custom events. Further information on {{slink|Commands/jfr|Usage}}. | ||
|- | |- | ||
| <code>'''--nogui'''</code> || Disable the [[#Interface|GUI]] when launching the server. | | <code>'''--nogui'''</code> || Disable the [[#Interface|GUI]] when launching the server. | ||
| Line 111: | Line 109: | ||
| <code>'''nogui'''</code> || Legacy alias of <code>'''--nogui'''</code>. | | <code>'''nogui'''</code> || Legacy alias of <code>'''--nogui'''</code>. | ||
|- | |- | ||
| <code>'''--pidFile''' ''<path>''</code> || Create a text file at <code>''path''</code> containing the {{ | | <code>'''--pidFile''' ''<path>''</code> || Create a text file at <code>''path''</code> containing the {{w|process identifier}} (PID) of the server process while it's running. | ||
|- | |- | ||
| <code>'''--port''' ''<port>''</code> || Specify the TCP port to use instead of the value in <code>server.properties</code>. | | <code>'''--port''' ''<port>''</code> || Specify the TCP port to use instead of the value in <code>server.properties</code>. | ||
|- | |- | ||
| <code>'''--recreateRegionFiles'''</code> || Optimize the world similar to <code>'''--forceUpgrade'''</code>, but also rewrites all the chunks independently of whether they have been upgraded, creating fresh and defragmented region files.<ref>{{Cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-24w04a |title=Minecraft Snapshot 24w04a |section=Region file compression algorithm |author=Java Team |website=Minecraft.net |date=January 24, 2024}}</ref> Using this option after changing <code>region-file-compression</code> in <code>server.properties</code> will recompress all region files in the new format. | | <code>'''--recreateRegionFiles'''</code> || Optimize the world similar to <code>'''--forceUpgrade'''</code>, but also rewrites all the chunks independently of whether they have been upgraded, creating fresh and defragmented region files.<ref>{{Cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-24w04a |title=Minecraft Snapshot 24w04a |section=Region file compression algorithm |author=Java Team |website=[[Minecraft:Minecraft.net]] |date=January 24, 2024}}</ref> Using this option after changing <code>region-file-compression</code> in <code>server.properties</code> will recompress all region files in the new format. | ||
|- | |- | ||
| <code>'''--safeMode'''</code> || Ensure the server only loads the vanilla data pack. | | <code>'''--safeMode'''</code> || Ensure the server only loads the vanilla [[Minecraft:data pack]]. | ||
|- | |- | ||
| <code>'''--serverId''' ''<id>''</code> || Specify the "Server Id" string used in the crash report details. | | <code>'''--serverId''' ''<id>''</code> || Specify the "Server Id" string used in the [[Minecraft:crash]] report details. | ||
|- | |- | ||
| <code>'''--universe''' ''<path>''</code> || Specify the path to the directory <code>level-name</code> in <code>server.properties</code> is relative to. If empty, it is relative to the working directory. | | <code>'''--universe''' ''<path>''</code> || Specify the path to the directory <code>level-name</code> in <code>server.properties</code> is relative to. If empty, it is relative to the working directory. | ||
| Line 129: | Line 127: | ||
The <code>server.jar</code> 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 <code>server.jar</code> 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>{{Cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-21w39a |title=Minecraft Snapshot 21w39a |section=Server bundling |website=Minecraft.net |author=Adrian Östergård |date=September 29, 2021}}</ref> | The following system properties can change the startup behavior:<ref>{{Cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-21w39a |title=Minecraft Snapshot 21w39a |section=Server bundling |website=[[Minecraft:Minecraft.net]] |author=Adrian Östergård |date=September 29, 2021}}</ref> | ||
* <code>bundlerMainClass</code>: Specifies the main class to start. If not specified, the main class defined on <code>META-INF/main-class</code> file in the <code>server.jar</code> (usually <code>net.minecraft.server.Main</code>) is used instead. There are three available main classes: | * <code>bundlerMainClass</code>: Specifies the main class to start. If not specified, the main class defined on <code>META-INF/main-class</code> file in the <code>server.jar</code> (usually <code>net.minecraft.server.Main</code>) is used instead. There are three available main classes: | ||
** <code>net.minecraft.server.Main</code>: Used for launching the ''Minecraft'' server. | ** <code>net.minecraft.server.Main</code>: Used for launching the ''Minecraft'' server. | ||
** <code>net.minecraft.data.Main</code>: Used as entry point for {{tpl|MCW:Projects/wiki.vg merge/Data Generators|data generators|vg}}. | ** <code>net.minecraft.data.Main</code>: Used as entry point for {{tpl|MCW:Projects/wiki.vg merge/Data Generators|data generators|vg}}. | ||
** <code>net.minecraft.gametest.Main</code>: Used as an entry point for the [[Minecraft:GameTest]] framework, which provides its own command-line options.<ref>{{cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-25w03a |title=Minecraft Snapshot 25w03a |section=Technical Changes |website=Minecraft.net |date=January 15, 2025}}</ref> | ** <code>net.minecraft.gametest.Main</code>: Used as an entry point for the [[Minecraft:GameTest]] framework, which provides its own command-line options.<ref>{{cite |url=https://www.minecraft.net/en-us/article/minecraft-snapshot-25w03a |title=Minecraft Snapshot 25w03a |section=Technical Changes |website=[[Minecraft:Minecraft.net]] |date=January 15, 2025}}</ref> | ||
** ''Unspecified'': If no option is specified or an empty blank string (<code>""</code>) is entered, it results in <code>Empty main class specified, exiting</code>. | ** ''Unspecified'': If no option is specified or an empty blank string (<code>""</code>) is entered, it results in <code>Empty main class specified, exiting</code>. | ||
: Before executing the main class, the JAR file automatically extracts {{ | : Before executing the main class, the JAR file automatically extracts {{cd|libraries}} and {{cd|versions}} folders, even for ''unspecified'' option. | ||
* <code>bundlerRepoDir</code>: Specifies the working directory for the resources extraction. If not specified, the current working directory is used instead. | * <code>bundlerRepoDir</code>: Specifies the working directory for the resources extraction. If not specified, the current working directory is used instead. | ||
System properties are specified like <code>-D''<property>''</code>, which ''property'' is the name defined above. They must be specified for the JVM program in the command-line, placed before <code>-jar</code> parameter (otherwise it will be specified for the <code>server.jar</code> file, which is invalid), e.g. {{ | System properties are specified like <code>-D''<property>''</code>, which ''property'' is the name defined above. They must be specified for the JVM program in the command-line, placed before <code>-jar</code> parameter (otherwise it will be specified for the <code>server.jar</code> file, which is invalid), e.g. {{Nowrap|1=<code>java -DbundlerMainClass="net.minecraft.data.Main" -jar server.jar</code>}} is a valid execution. | ||
== History == | == History == | ||
{{ | {{For|general multiplayer server history|Multiplayer#History}} | ||
{{ | {{See also|Server.properties#History}} | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java classic}} | ||
|{{HistoryLine||server 1.2|The earliest archived version. | |{{HistoryLine||server 1.2|The earliest archived version by the community ([https://omniarchive.uk/ Omniarchive]). | ||
|[[Minecraft:Server.properties]] options at this time include {{ | |[[Minecraft:Server.properties]] options at this time include {{cd|port}}, {{cd|server-name}}, {{cd|max-players}}, {{cd|motd}}, {{cd|public}}.}} | ||
|{{ | |{{HistoryLine|java alpha}} | ||
|{{ | |{{HistoryLine||1.0.15|<code>server.jar</code> was released to the public for [[Minecraft:Survival]] multiplayer server.}} | ||
|{{ | |{{HistoryLine|java edition}} | ||
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 4|Added {{ | |{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 4|Added {{cd|debug}}, {{cd|enable-query}}, {{cd|enable-rcon}}, {{cd|query.port}}, {{cd|rcon.password}} and {{cd|rcon.port}}.|This marked the first introduction of [[Minecraft:Query]] and [[Minecraft:Remote console]] (RCON) protocols.}} | ||
|{{ | |{{HistoryLine||1.0.1|<code>server.jar</code> was updated in a server-only release. | ||
|Fixed <code>Invalid server key</code> error when logging in. | |Fixed <code>Invalid server key</code> error when logging in. | ||
|Fixed <code>Null pointer exception</code> error when logging in.}} | |Fixed <code>Null pointer exception</code> error when logging in.}} | ||
|{{ | |{{HistoryLine||1.3.1|dev=12w18a|The server logic was separated from the client, making singleplayer effectively run an internal server. | ||
|Added command-line arguments: <code>--demo</code>, <code>--port</code>, <code>--singleplayer</code>, <code>--universe</code>, and <code>--world</code>. The legacy <code>nogui</code> argument remained functional.}} | |Added command-line arguments: <code>--demo</code>, <code>--port</code>, <code>--singleplayer</code>, <code>--universe</code>, and <code>--world</code>. The legacy <code>nogui</code> argument remained functional.}} | ||
|{{ | |{{HistoryLine|||dev=12w19a|Added the <code>--bonusChest</code> command-line argument.}} | ||
|{{ | |{{HistoryLine|||dev=12w21a|Removed <code>server.jar</code> dependency in singleplayer.}} | ||
|{{ | |{{HistoryLine||1.16|dev=20w20b|The dedicated server main class was changed from <code>net.minecraft.server.MinecraftServer</code> to <code>net.minecraft.server.Main</code>.}} | ||
|{{ | |{{HistoryLine|||dev=20w22a|Added the <code>--safeMode</code> command-line argument.}} | ||
|{{ | |{{HistoryLine||1.18|dev=21w37a|Added the <code>--jfrProfile</code> command-line argument.}} | ||
|{{ | |{{HistoryLine|||dev=21w39a|Changed the file structure of <code>server.jar</code>. 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 <code>bundlerRepoDir</code> property (defaults to the working directory). | |Server startup now unpacks libraries into a directory configured by the <code>bundlerRepoDir</code> property (defaults to the working directory). | ||
|The main class can be changed using the <code>bundlerMainClass</code> property.}} | |The main class can be changed using the <code>bundlerMainClass</code> property.}} | ||
|{{ | |{{HistoryLine|||dev=1.18-pre3|Starting <code>server.jar</code> with an empty <code>bundlerMainClass</code> property now validates and extracts files, then exits.}} | ||
|{{ | |{{HistoryLine||1.20|dev=23w06a|Added the <code>--pidFile</code> command-line argument.}} | ||
|{{ | |{{HistoryLine||1.20.2|dev=23w31a|Removed the <code>--singleplayer</code> command-line argument.}} | ||
|{{ | |{{HistoryLine||1.20.5|dev=24w04a|Added the <code>--recreateRegionFiles</code> command-line argument. | ||
|Added the <code>region-file-compression</code> setting to [[Minecraft:server.properties]].}} | |Added the <code>region-file-compression</code> setting to [[Minecraft:server.properties]].}} | ||
|{{ | |{{HistoryLine||1.21.4|dev=24w45a|The data generator entry point (<code>net.minecraft.data.Main</code>) no longer generates the assets directory. | ||
|The <code>--client</code> command-line option was removed for the data generator entry point.}} | |The <code>--client</code> command-line option was removed for the data generator entry point.}} | ||
|{{ | |{{HistoryLine||1.21.5|dev=25w03a|Added the <code>net.minecraft.gametest.Main</code> entry point for running automated game tests from <code>server.jar</code>. | ||
|Added associated command-line arguments for the gametest entry point: <code>--help</code>, <code>--packs</code>, <code>--report</code>, <code>--tests</code>, <code>--universe</code>, and <code>--verify</code>.}} | |Added associated command-line arguments for the gametest entry point: <code>--help</code>, <code>--packs</code>, <code>--report</code>, <code>--tests</code>, <code>--universe</code>, and <code>--verify</code>.}} | ||
|{{ | |{{HistoryLine||1.21.9|dev=25w35a|Added the [[Minecraft:Minecraft Server Management Protocol]] (MSMP).}} | ||
|{{ | |{{HistoryLine|||dev=25w37a|MSMP clients must authenticate to access the API.|MSMP TLS is enabled by default.}} | ||
}} | }} | ||
== Issues == | == Issues == | ||
{{ | {{Issue list|server.jar|server jar|java server|projects=mc}} | ||
== Notes == | |||
{{fnlist}} | |||
== References == | == References == | ||
| Line 184: | Line 185: | ||
== See also == | == See also == | ||
* [[Minecraft:Bedrock Dedicated Server]], the server software used to host a {{ | * [[Minecraft:Bedrock Dedicated Server]], the server software used to host a {{BE}} server. | ||
* [[Minecraft:client.jar]], the program and resources for the '' Java Edition'' game. | * [[Minecraft:client.jar]], the program and resources for the ''[[Minecraft: Java Edition]]'' game. | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox Java Edition technical|general}} | ||
[[Category:Server]] | [[Category:Server]] | ||
de:server.jar | [[Minecraft:de:server.jar]] | ||
fr:server.jar | [[Minecraft:fr:server.jar]] | ||
ja:Server.jar | [[Minecraft:ja:Server.jar]] | ||
pt:Server.jar | [[Minecraft:pt:Server.jar]] | ||
zh:服务端核心文件 | [[Minecraft:zh:服务端核心文件]] | ||
Latest revision as of 11:22, 17 May 2026
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.
Contents
The server.jar file can be opened with a Template:W that supports ZIP files. It contains the program and default resources shared with the Minecraft:client.jar, but excluding client-specific code, like Minecraft:rendering and Minecraft:audio output, Minecraft:GUI, Minecraft:models, and others; both are identical in Minecraft:gameplay. It is intended to host a dedicated environment for Minecraft:multiplayer, being able to launch a headless<ref group="fn">On a headless environment without a graphical interface; if present, the server.jar will launch with a basic GUI by default, but can be disabled with --nogui option.</ref> version of the game. The client.jar file also provides an internal server used for playing Minecraft:singleplayer worlds that can be opened into Minecraft:LAN.
The archive also contains a Minecraft:version.json file, which provides the game's version information, including the version ID (e.g., Template:V), Minecraft:data version, Minecraft:pack version, Minecraft:protocol version, and others.
Generated server directory
Upon running the server.jar, 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 following contents are generated by default when no option is specified:
- "*" marks a file that is not generated until the EULA (in
eula.txt) is accepted.
- 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 directly contains the game's code and resources (similar to
Minecraft:client.jarwithout client-related files). - 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 with CRLF line endings on Windows or LF line endings on Linux and macOS.
- Template:File*: World data directory. The name can be specified in
server.propertiesbylevel-nameoption. - Template:File*: Specifies IP addresses that are banned from the server.
- Template:File*: Specifies players that are banned from the server.
- 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.
- Template:File: Server icon in Template:W file format with 64×64 pixels resolution, which appears for the client in their Minecraft:server list. Not generated automatically.
- Template:File: The server software JAR file, used to setup the working directory, and starting up the server. It must be placed in the same directory as the rest of the server files.
- Template:File: Preset configuration file used to configure most of the server's functionality.
- Template:File*: Specifies players that are whitelisted.
Files are generated on the first run if not present in the same directory as server.jar.
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 features three sections:
- "Stats" which displays memory usage (graph and number percentage) 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
Notes
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:服务端核心文件