Minecraft:Server.jar: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| 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. | ||
Code is shared between <code>server.jar</code> and <code>[[Minecraft:client.jar]]</code>, meaning they are identical in gameplay. The <code>client.jar</code> file provides an internal server used for playing singleplayer worlds, but <code>server.jar</code> does not provide a client. | Code is shared between <code>server.jar</code> and <code>[[Minecraft:client.jar]]</code>, meaning they are identical in [[Minecraft:gameplay]]. The <code>client.jar</code> file provides an internal server used for playing [[Minecraft:singleplayer]] worlds, but <code>server.jar</code> does not provide a client. | ||
== 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. | ||
When ran, 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}}. | When ran, 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}}. | ||
The archive also contains a <code>version.json</code> file, which provides version information. | The archive also contains a <code>[[Minecraft:version.json]]</code> file, which provides version information. | ||
== Directory structure == | == Directory structure == | ||
| Line 51: | Line 51: | ||
*** {{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, CRLF line endings on Windows, LF line endings on Linux and macOS. | *** {{File|file|latest.log}}: The most recent log. UTF-8 format, CRLF line endings on Windows, LF line endings on Linux and macOS. | ||
** {{File|directory|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|directory|world}}: [[Minecraft:Java Edition level format|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|banned-ips.json}}: Specifies IP addresses that are banned from the server. Not generated until the EULA is accepted. | ** {{File|file|banned-ips.json}}: Specifies IP addresses that are banned from the server. Not generated until the EULA is accepted. | ||
** {{File|file|banned-players.json}}: Specifies players that are banned from the server. Not generated until the EULA is accepted. | ** {{File|file|banned-players.json}}: Specifies players that are banned from the server. Not generated until the EULA is accepted. | ||
** {{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. Not generated until the EULA is accepted. | ** {{File|file|[[Minecraft:ops.json]]}}: Specifies [[Minecraft:operator]] status of players. Not generated until the EULA is accepted. | ||
** {{File|file|server-icon.png}}: Server icon that appears on the server list. Not generated automatically. Must be in PNG format and 64x64 pixels. | ** {{File|file|server-icon.png}}: Server icon that appears on the server list. Not generated automatically. Must be in PNG format and 64x64 pixels. | ||
** {{File|archive|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|archive|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|[[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. Not generated until the EULA is accepted. | ** {{File|file|[[Minecraft:whitelist.json]]}}: Specifies players that are whitelisted. Not generated until the EULA is accepted. | ||
</div> | </div> | ||
| Line 74: | Line 74: | ||
</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 it features three sections: | ||
* "Stats" which displays memory usage as a graph and as a value, and average tick time, | * "Stats" which displays memory usage as a graph and as a value, and average tick time, | ||
* "Players" which displays a player list, and | * "Players" which displays a player list, and | ||
| Line 93: | Line 93: | ||
! 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 105: | ||
| <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 111: | ||
| <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 129: | ||
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. | ||
|[[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}} | ||
== References == | == References == | ||
| Line 184: | Line 184: | ||
== 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:服务端核心文件]] | ||
Revision as of 11:13, 13 April 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.
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:服务端核心文件