{{Lowercase title}}
{{Infobox program
| title = server.jar
| author =
* [[File:Mojang Studios logo.svg|x20px|link=Mojang Studios]] [[Mojang Studios]]
| platform = {{OS|win|mac|lin}} and other platforms that support running a JVM
| programming language = {{OS|java}} {{w|Java (programming language)|Java}}
| price = Free
| license = [https://www.minecraft.net/en-us/eula EULA]
| website = https://www.minecraft.net/en-us/download/server
| source available = Partial
| size =
* Only JAR: ≈ 54 MiB
* With initial generated data: ≈ 114 MiB
| version =
* '''Release''': {{v|java}}
{{#if: {{v|java-snap}} | * '''Snapshot''': {{v|java-snap}} }}
| date = June 8, 2009
}}
[[File:Server.jar GUI.png|thumb|The server.jar GUI.]]

'''server.jar''' is the server software used to host a {{JE}} [[server]]. It is distributed by Mojang and can be downloaded for free. It is provided as a crossplatform JAR file.

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

== Data ==

The server software keeps data in the working directory. This includes the [[server.properties]] file, used to configure most of the functionality, as well as other configuration files, world data, logs and libraries.

=== Directory structure ===

<div class="treeview">
* {{File|directory|''working directory''}}: The working directory of the server software process.
** {{File|directory|libraries}}: Contains JAR files as well as shared objects with library code.
** {{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|latest.log}}: The most recent log. UTF-8 format, LF line endings on Linux, CRLF on Windows.
** {{File|directory|versions}}: Contains JAR files with primary server software code.
*** {{File|directory|''version number''}}: Contains files for a specific server software version.
**** {{File|archive|server-''version number''.jar}}: JAR file containing the primary code for that server software version.
** {{File|directory|world}}: World 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. Not generated until the EULA is accepted.
** {{File|file|banned-players.json}}: Specifies players that are banned. 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|[[ops.json]]}}: Specifies OP 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. PNG format.
** {{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|[[server.properties]]}}: Primary configuration file for the server software.
** {{File|file|[[whitelist.json]]}}: Specifies players that are whitelisted. Not generated until the EULA is accepted.
</div>

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

=== eula.txt ===

If an {{File|file|eula.txt|inline=1}} file doesn't 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 Properties syntax. <code>eula</code> has to be set to <code>true</code> for the server to start.

== Interface ==

The server software has both a command line interface and a rudimentary {{w|GUI}}.

The command line interface outputs logs to the standard output, and accepts newline delimeted input from the standard input, which is executed by the server as [[commands]] (similar to being executed by [[command block]]s, but always with the highest privilege level).

The GUI appears if the platform supports windowing and the <code>--nogui</code> option is not provided. The GUI 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,
# ''Players'' which displays a player list, and
# ''Log and chat'' which displays logs.

== Command line options ==

{| class="wikitable"
|-
! Option !! Description
|- 
| '''--bonusChest''' || Enable the [[bonus chest]] when generating a world.
|-
| '''--demo''' || Enable [[demo mode]].
|-
| '''--eraseCache''' ||
|-
| '''--forceUpgrade''' ||
|-
| '''--help''' || Print available options instead of starting the server.
|-
| '''--initSettings''' || Initialize server.properties and eula.txt and exit, rather than starting the server.
|-
| '''--jfrProfile''' ||Java Flight Recorder profile.{{info needed}}
|-
| '''--nogui''' || Do not launch the GUI, even if the platform supports windowing.
|-
| '''nogui''' || Legacy alias for --nogui.
|-
| '''--pidFile''' ''path'' ||
|-
| '''--port''' ''port'' || Specify the TCP port to use instead of the value in server.properties.
|-
| '''--recreateRegionFiles''' ||
|-
| '''--safeMode''' || Only load the vanilla datapack.
|-
| '''--serverId''' ''id'' ||
|-
| '''--universe''' ''path'' ||
|- 
| '''--world''' ''name'' || Specify the world name to use instead of the value in server.properties.
|}
== See also ==
* [[Bedrock Dedicated Server]] - the server software used to host a {{BE}} server

== Navigation ==
{{Navbox Java Edition technical|general}}

[[Category:Server]]
