In this short article, I’m going to be the explanation of the Java command for running an application with minecraft_server.1.19.2.jar with some flags. java -xmx1024m -xms1024m -jar minecraft_server.1.19.2.jar nogui is the command I referred and let’s break them into small pieces.
- java: This is the command for starting the Java application. Once start with Java JVM(Java Virtual Machine) execute the command and then run the minecraft_server.1.19.2.jar
- -xmx1024m: This is the runtime maximum storage size for the application or in other words heap size for JVM. As you know heap contains objects at run time. In this case, it has allocated 1024Mb (1 Gb) from memory. Example: -xmx512m sets the maximum heap size to 512 MB.
- -xms1024m: This is the initial heap size for JVM. Once the minecraft_server.1.19.2.jar starts memory size allocate according to this value: -xms256m sets the initial heap size to 256 MB.
- -jar minecraft_server.1.19.2.jar: This is the executable Jar file. Once the command contains -jar <Jar file name> then realize the executable jar file have to run by JVM. Its some times can have the file path for a jar file.
- nogui: This flag is for running the jar file in the command line without using GUI. Otherwise, ser will start on GUI.
Full Command Example:
-- Let's put it all together with an example command: java -Xmx2048m -Xms1024m -jar minecraft_server.1.19.2.jar nogui ava -Xmx2048m -Xms1024m -jar minecraft_server.1.19.2.jar nogui --
In this example:
- maximum heap size of 2048 MB (2 GB)
- initial heap size of 1024 MB (1 GB).
- The Minecraft server version 1.19.2 is used from the JAR file “minecraft_server.1.19.2.jar”.
- console-only (“nogui”) mode.
Note: This command is valid on run command in the file location otherwise you have to run a command with including the file path as well.
Note: Memory allocation for Java applications is not straightforward. It should be balanced. It depends on application memory usage and your physical memory sizes.
If you want a complete tutorial on Minecraft multiplayer server you can see this wiki article for a tutorial). First, make sure you installed Java on a machine and set up environment variables. Try java – version in the command line to verify the run java on the machine. On Linux and macOS this should exist, but on Windows, add PATH environment variable to work properly.
Download page: https://www.minecraft.net/en-us/download/server
How To Setup A Minecraft: Java Edition Server : https://help.minecraft.net/hc/en-us/articles/360058525452-How-to-Setup-a-Minecraft-Java-Edition-Server