Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Launch a Minecraft: Java Edition dedicated server with the command java [JVM options] -jar server.jar [server options]. Java memory and garbage-collection settings go before -jar; Minecraft server flags go after the JAR filename. For a headless machine, the usual command is java -jar server.jar --nogui.

This guide explains the supported startup flags, how they interact with server.properties, how to write reliable Linux and Windows startup scripts, and which maintenance options require backups and a maintenance window.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the Minecraft server command is parsed

The Java server has two argument layers. The Java runtime parses options first, then the server JAR parses its own options:

java [JVM options] -jar server.jar [Minecraft server options]

For example:

java -Xms2G -Xmx2G -jar server.jar --nogui

Here, -Xms2G and -Xmx2G configure the Java heap. The --nogui argument is read by Minecraft. Putting a Minecraft flag before -jar, or a JVM option after the JAR name, can produce an “unrecognized option” error or cause the setting to be ignored.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Run commands from the directory containing the server JAR, or use the JAR’s complete path. The filename is not required to be literally server.jar; replace it with the name of the file you downloaded.

Before you start

Install a compatible Java runtime

Use the Java version required by the exact Minecraft: Java Edition server release you downloaded. A server may refuse to start, terminate with a class-version error, or behave unpredictably when run with an incompatible runtime. Check the release’s official server documentation rather than assuming that the Java version installed for another application is suitable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Accept the EULA and create configuration files

On a first launch, the server creates files such as eula.txt and server.properties. You must review the Minecraft End User License Agreement and change the EULA setting as required before running a server for players. The initialization-only option described below can create these files without starting the game server, which is useful for automated provisioning.

Use a dedicated directory

Keep the JAR, world folders, logs, eula.txt, and server.properties together in a directory owned by the account that will run the server. This prevents a service manager from creating worlds in an unexpected working directory.

Core startup flags

Flag What it does Scope and cautions
--help Prints the server options available to that JAR. Use it to verify support before adding a flag to a script; it does not start the server.
--nogui Starts without the graphical server window. Best for headless machines, containers, SSH sessions, and service hosts.
--port <number> Selects the listening port for that launch. It is a run-time override. Persistent settings and router forwarding are separate tasks.
--world <name> Selects the world directory to load. The directory must exist under the configured save root, or be created as part of normal world generation.
--universe <path> Selects the root directory containing world saves. Use an absolute or correctly resolved path in service scripts to avoid loading the wrong save.
--initSettings Creates or initializes server.properties and eula.txt without starting the game server. Useful in provisioning scripts; edit the generated files before the normal launch.
--demo Enables demo behavior. Use only when the server is intentionally being configured for that mode.
--bonusChest Enables a bonus chest when a world is generated for the first time. It affects initial world generation, not an already-created world.
--nojline Disables JLine console handling. Documented in Paper’s command-line reference; verify that your exact server implementation supports it.
--jfrProfile Starts Java Flight Recorder profiling according to the server reference. Treat it as a diagnostic option and confirm support in the exact server version before enabling it routinely.
--forceUpgrade Optimizes world data by upgrading level data to a newer format. It changes world files and can remove compatibility with older level formats. Back up first.
recreateRegionFiles Rewrites chunks independently of whether they were upgraded. Introduced in the 24w04a release notes; useful when regenerating region files after changing the region-file-compression property.
--eraseCache Erases cached light and biome data. The data must be regenerated, so startup can take longer and files will be modified.

Flag spelling and availability can differ between Mojang server versions and server implementations. Run java -jar server.jar --help with the exact JAR you intend to operate, then compare the output with that release’s documentation.

Essential launch examples

Headless launch with a fixed heap

java -Xms2G -Xmx2G -jar server.jar --nogui

This sets both the initial and maximum Java heap to 2 GiB and suppresses the graphical window. The values are examples, not universal requirements; leave enough memory for the operating system and other services.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Named world on a non-default port

java -Xmx4G -jar server.jar --world survival --port 25566 --nogui

The server loads the survival world and uses port 25566 for this process. Clients must connect to that port, and any firewall or router rule must match it.

Initialize files without starting gameplay

java -jar server.jar --initSettings

After this command exits, inspect and edit eula.txt and server.properties, then launch normally. This pattern is convenient for image-building and first-boot scripts because configuration generation is separate from service startup.

Use a separate save root

java -Xmx4G -jar server.jar --universe /srv/minecraft/saves --world creative --nogui

Use a path that the service account can read and write. An absolute path avoids ambiguity when a service manager chooses a different working directory.

JVM options versus Minecraft options

-Xms and -Xmx are Java options. They control heap allocation and must appear before -jar. Other JVM system properties and garbage-collection options follow the same rule:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
java -Xms4G -Xmx8G -Dsome.property=value -jar server.jar --nogui

Do not write java -jar server.jar -Xmx8G --nogui; the server’s argument parser is not the place to set Java heap size. If a service wrapper has a separate field for JVM arguments, put memory and system-property options there and keep server flags in the application-arguments field.

Choosing heap values

  • -Xms: the heap size requested at startup.
  • -Xmx: the maximum heap the JVM may use.
  • Operating-system headroom: reserve memory for the OS, file cache, backups, monitoring, and any other services.
  • Evidence: the command syntax does not establish a universally correct allocation; size the heap from your player load and observed logs rather than copying a number blindly.

Headless operation and console behavior

--nogui removes the graphical server window while leaving the normal server console available. It is the appropriate choice for SSH sessions, virtual machines, containers, and system services. Mojang’s download guidance describes omitting the “nogui” part when a graphical interface is wanted; therefore a command without --nogui may open the GUI when the runtime environment supports it.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

In an interactive console, stop the server with the stop command rather than killing the Java process. A graceful stop lets the server save world data and close files. A service manager should send a termination signal and allow a sufficient stop timeout before considering a forced kill.

If console input is garbled or a wrapper cannot handle JLine, test --nojline only when the exact implementation documents it. Do not add implementation-specific flags to a vanilla script without checking --help.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Changing the port and persistent network settings

One-run override

Use --port <number> when a particular launch must listen on a different port:

java -jar server.jar --port 25566 --nogui

This is a command-line choice for that run. It does not replace the persistent configuration file or automatically change network equipment.

Persistent configuration

server.properties is read by the server and stores settings intended to persist across restarts. The official help documentation identifies query.port as the port to forward and gives 25565 as its default. When changing network behavior, check the relevant property, the server’s actual listening port, the host firewall, and the router’s forwarding rule as four separate items.

After editing server.properties, stop and restart the server so the new values are loaded. Keep a copy of the working file before making several changes at once.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Other useful properties

The persistent file also includes settings such as gamemode, spawn-protection, allow-nether, difficulty, pvp, max-players, level-seed, and motd. These are configuration properties, not replacements for JVM arguments, and they generally belong in server.properties rather than in the startup command.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

World selection and world-maintenance flags

Selecting a world safely

--world <name> chooses a world directory, while --universe <path> chooses the save root. Together they let one JAR serve different worlds from separate directories:

java -jar server.jar --universe /srv/minecraft --world event-2026 --nogui

Confirm the path before starting. A typo can make the server generate a new world, which may look like data loss even though the original save is still elsewhere.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What --forceUpgrade changes

--forceUpgrade optimizes world data by upgrading level data to a newer format. The optimization path also upgrades entity and point-of-interest data where applicable. Once processed, the world may not remain compatible with older level formats.

  1. Stop the server cleanly.
  2. Make and verify a complete backup of the world directory and related configuration.
  3. Test the backup by opening it on a separate copy, not the production save.
  4. Run the upgrade during a maintenance window with sufficient disk space.
  5. Review logs and world loading before allowing players back in.

Do not treat this as a routine performance switch. Rollback means restoring the tested backup, not merely removing the flag and starting again.

recreateRegionFiles and --eraseCache

The 24w04a release notes describe recreateRegionFiles as rewriting chunks regardless of whether they were upgraded. It can regenerate region files after changing the region-file-compression property. --eraseCache removes cached light and biome data, which the server then regenerates. Both operations can increase startup time and modify many files, so use the same backup, disk-space, and maintenance-window process as an upgrade.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Writing a dependable Linux startup script

A small shell script makes the working directory, heap values, and server flags explicit:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#!/usr/bin/env bash
set -euo pipefail
cd /srv/minecraft
exec java -Xms2G -Xmx4G -jar server.jar --nogui

cd ensures relative paths resolve inside the server directory. exec makes the Java process the script’s main process, which helps service managers deliver signals correctly. Make the file executable with your operating system’s normal permissions tool and run it as a dedicated, non-root account whenever possible.

Adding a selected world and port

#!/usr/bin/env bash
set -euo pipefail
cd /srv/minecraft
exec java -Xmx4G -jar server.jar --world survival --port 25566 --nogui

Keep the command’s arguments in the script that owns that service. If you operate several worlds, use separate working directories or explicitly set --universe and --world for each instance.

Writing a Windows batch startup script

In a batch file, change to the server directory before launching Java:

@echo off
cd /d C:MinecraftServer
java -Xms2G -Xmx4G -jar server.jar --nogui
pause

The /d switch also changes drives. The final pause keeps the window open after an error so you can read it; omit it when a service manager owns the process. Quote paths containing spaces, for example cd /d "C:Game ServersSurvival".

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnosing common startup failures

“Unrecognized option” or the process exits immediately

  • Run java -jar server.jar --help with the same JAR.
  • Move -Xms, -Xmx, and other JVM options before -jar.
  • Move --nogui, --port, and other server flags after the JAR filename.
  • Remove flags documented only for another implementation or release.

The wrong world loads or a new world appears

  • Print or inspect the service’s working directory.
  • Verify the spelling and case of --world.
  • Verify that --universe points to the save root containing that world.
  • Stop the process and locate the original save before generating more data.

Players cannot connect after changing the port

  • Confirm the server log reports the intended listening port.
  • Check the host firewall for that port and protocol.
  • Update the router forwarding rule; the official help page documents 25565 as the default query port.
  • Have clients specify the non-default port in the address.
  • Check that no second server is already using the selected port.

The server starts with a window on a machine intended to be headless

Add --nogui after the JAR name. If a service wrapper still opens a window, inspect the wrapper’s command and ensure it is not launching a separate GUI command.

Startup becomes much slower after maintenance

--forceUpgrade, recreateRegionFiles, and --eraseCache can rewrite data or trigger regeneration. Read the log, allow the maintenance operation to finish, and do not interrupt it unless you are following a tested recovery procedure.

A practical flag-selection checklist

  • Need a graphical window? Omit --nogui; otherwise include it.
  • Need a different heap? Set -Xms and -Xmx before -jar.
  • Need a one-run port or world? Use --port or --world after the JAR name.
  • Need settings to survive restarts? Edit server.properties and restart.
  • Provisioning a new instance? Run --initSettings, then review eula.txt and properties before normal startup.
  • Changing world data? Back up, test the backup, schedule maintenance, and verify the exact release’s documentation.
  • Unsure whether a flag exists? Run --help against the exact downloaded JAR.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.