Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

Minecraft Server Command Line Options and Startup Flags

A practical reference for Minecraft: Java Edition server startup flags: separate JVM options from server options, run headless instances, select worlds and ports, initialize files and safely handle maintenance operations.
Length8 min Posted Quest giverVGSources Team

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Launch a Minecraft: Java Edition dedicated server with java [JVM options] -jar server.jar [server options]. Put heap and garbage-collection settings before -jar; put Minecraft options such as --nogui, --port, and --world after the JAR filename. For a headless server, the usual command is java -jar server.jar --nogui.

This guide covers the Java Edition server JAR and scripts run from its server directory. Bedrock Dedicated Server and Minecraft Launcher client flags use different interfaces and are not covered.

As an Amazon Associate I earn from qualifying purchases.

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

How the Minecraft server command line is structured

The command line has two argument layers. Java reads options that appear before -jar; the Minecraft server reads options that appear after the JAR filename. Keeping those layers separate prevents the most common startup errors.

Layer Position Examples What it controls
JVM Before -jar -Xms2G, -Xmx4G, garbage-collection and Java system-property options The Java process, including heap size and runtime behavior
Minecraft server After server.jar --nogui, --port 25566, --world survival The server’s interface, world selection, network choice and diagnostics

A valid command therefore looks like java -Xms2G -Xmx4G -jar server.jar --nogui. Moving -Xmx after the JAR does not turn it into a server setting; Java has already handed argument parsing to the server at that point. The server reference also requires JVM system properties to appear before -jar.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

First launch and file initialization

Download the Java Edition server JAR and use a compatible Java runtime. Run the command from the directory that contains the JAR. If the filename contains spaces, quote it according to your shell’s normal rules.

  1. Check the available flags. Run java -jar server.jar --help. This prints the options recognized by that exact server build without starting the game server.
  2. Initialize configuration files when provisioning. Run java -jar server.jar --initSettings. The option creates or initializes server.properties and eula.txt without starting the game server.
  3. Review the generated files. Edit eula.txt as required by the EULA and set persistent values in server.properties.
  4. Start the server. Use a command such as java -Xms2G -Xmx2G -jar server.jar --nogui, adjusting the heap and server flags for the machine and release.

The official setup guidance also shows the basic form java -jar “your jar name”.jar from the server directory. Use the actual filename downloaded for your release rather than assuming every build is called server.jar.

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

Core startup flags

The following options are the most useful for shell scripts, batch files and service definitions. Run --help on the installed JAR before relying on a flag: options can differ between releases and between server implementations.

Flag Purpose Scope and cautions
--help Prints the server’s available command-line options. Discovery only; it does not start the game server.
--nogui Disables the graphical server window. Preferred for headless machines, remote hosts and service managers. Mojang setup examples sometimes show the legacy nogui spelling; current references describe the double-hyphen form.
--port <number> Selects the listening port for that launch. A run-time override. It does not by itself rewrite persistent properties or router rules.
--world <name> Selects the world directory. Useful when one server directory contains several world saves.
--universe <path> Selects the save root used by the server. Changes where the server looks for world directories; use an explicit path in automated deployments.
--initSettings Creates or initializes server.properties and eula.txt. Provisioning action; it exits without starting gameplay.
--demo Enables demo behavior. Applies to that server launch and the worlds it serves.
--bonusChest Enables a bonus chest when a world is generated for the first time. Only matters during first generation of a world; it does not add a chest to an already-created world.
--nojline Disables JLine console handling. Documented in Paper’s command-line reference. Verify availability when using a different implementation or a vanilla build.
--jfrProfile Starts Java Flight Recorder profiling according to the server reference. Use as a diagnostic option, not a routine performance switch, and confirm support in the exact server version.

Running without the graphical window

For a server on a terminal-only Linux host, container, virtual machine or Windows service account, append --nogui. The server still accepts console commands through its process input and writes its normal logs; only the graphical server window is suppressed. Mojang’s download guidance states that omitting the “nogui” part starts the graphical interface, so leaving the option out is intentional when a local window is wanted.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Selecting a world, save root or port

Use --world survival to select a directory named survival under the active save root. Use --universe /srv/minecraft when the save root itself must be relocated. To choose a different port for one invocation, add --port 25566. These flags are especially useful when a script starts different worlds or test instances from the same installation.

JVM memory options and server options are different

-Xms sets the JVM’s initial heap and -Xmx sets its maximum heap. They affect Java memory allocation, not a Minecraft property. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
java -Xms2G -Xmx2G -jar server.jar --nogui

This requests a 2 GiB initial and maximum heap for the Java process. Choose values that leave memory for the operating system, file cache and other services; the command is an example of placement and intent rather than a universal sizing recommendation. Garbage-collection options and JVM system properties follow the same placement rule: they belong before -jar.

Server flags follow the JAR name:

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

If a script mixes the two layers, put all Java options first, then -jar, then the JAR path, then server options. When a launch fails, inspect this ordering before changing world files or permissions.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Command-line choices versus server.properties

A command-line flag is a choice for a particular process start. server.properties is persistent configuration read by the server. Keep values that should survive restarts in the properties file, and use flags for per-run overrides, provisioning and diagnostics.

Need Use Operational note
Change the port for one run --port <number> Update firewall, proxy and forwarding rules to match that run.
Keep network settings across restarts server.properties The official help documentation identifies query.port as the port to forward and gives a default of 25565. Check the file and your network design rather than assuming a temporary command-line value is permanent.
Choose game rules and world-generation behavior server.properties Persistent settings include gamemode, spawn-protection, allow-nether, difficulty, pvp, max-players, level-seed and motd.
Run a different world or save root --world or --universe Useful for a temporary test world without replacing the main properties file.

Changing --port does not automatically configure a router or firewall. Forward the port used by the running instance, and document any distinction between the game connection and query settings in your network configuration.

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

World-maintenance and data-transformation flags

Maintenance options can rewrite world data, increase startup time or remove caches. Treat them as planned operations with a tested backup, a maintenance window and a rollback path.

--forceUpgrade

This option optimizes world data by upgrading level data to a newer format. After optimization, the world may no longer be compatible with older level formats. The relevant optimization path also upgrades entities and points-of-interest data. Stop the server, make a restorable copy of the entire world and verify that the target release is the one you intend to run before starting the upgrade.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

recreateRegionFiles

Mojang’s 24w04a release notes introduce recreateRegionFiles. It rewrites chunks independently of whether they were upgraded and can regenerate region files after changing the region-file-compression property. Because it rewrites region files, apply it only when that conversion is required, not as a general startup optimization.

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.

--eraseCache

The server reference describes --eraseCache as erasing cached light and biome data. The server must regenerate that data, so the next startup can take longer. Preserve a backup and allow the regeneration to finish before judging the result.

Safe maintenance sequence

  1. Announce downtime and stop the running server cleanly.
  2. Copy the world directories, server.properties and the current JAR to storage from which you can restore.
  3. Record the exact release, Java version and command used.
  4. Run one maintenance operation at a time, using --help and the matching release documentation to confirm syntax.
  5. Start the server, watch the log for completion or errors, and test player access and world loading.
  6. Keep the backup until the upgraded world has been validated; do not attempt to downgrade by simply replacing the JAR if the format is no longer compatible.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Ready-to-use startup examples

Headless two-gigabyte instance

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

This places both heap settings before the JAR and suppresses the graphical window.

Named world on a non-default port

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

The world and port choices apply to this launch. Configure corresponding firewall, forwarding and service settings outside the command if the instance is intended to be reachable.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Provision files before editing them

java -jar server.jar --initSettings

After it exits, edit eula.txt and server.properties, then start the server with the desired JVM and server options.

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

Troubleshooting startup scripts

The server rejects -Xmx or ignores a memory setting

Move the option before -jar. The correct pattern is java -Xmx4G -jar server.jar --nogui, not a command with -Xmx4G after the JAR filename.

The graphical window appears on a remote host

Add --nogui. If the script uses the legacy bare nogui token, replace it with the current flag form supported by the installed build and confirm the result with --help.

Players cannot connect after changing the port

Confirm the process is listening on the port selected by --port, then align the host firewall, router forwarding, proxy and any service definition. A one-run override does not rewrite persistent configuration.

The intended world does not load

Check the spelling and relative location supplied to --world, and check whether --universe points to the save root that actually contains that directory. Avoid running two processes against the same world.

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

A flag works on one server build but not another

Run java -jar server.jar --help on the exact JAR in use. Options such as --nojline may be implementation-specific, while diagnostic and maintenance flags can change between releases. Use the matching release notes before deploying a script change.

Startup checklist for production scripts

  • Use the Java runtime compatible with the downloaded Java Edition server release.
  • Run from a known server directory and use the exact JAR filename.
  • Place every JVM option before -jar and every server option after the JAR.
  • Use --nogui for headless or service-managed hosts.
  • Use --help to verify flags before scripting them.
  • Keep persistent gameplay and network values in server.properties; treat command-line values as launch-specific unless documented otherwise.
  • Back up worlds before --forceUpgrade, recreateRegionFiles or --eraseCache.
  • Record the command, Java version and server release so a working launch can be reproduced or rolled back.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.