20% OFF Your first order with SAVE20
Background image of the page
Border
What Are JVM Flags in Minecraft & Should You Use Them?
Article

What Are JVM Flags in Minecraft & Should You Use Them?

Carl S. Carl S. Nov 26, 2025
4 min read

What is a JVM Flag?

The Java Virtual Machine (JVM) is the software engine that runs Minecraft servers. Since Minecraft is written in Java, it requires the JVM to execute the game code and manage resources like memory, threads, and processing power.

JVM flags are configuration commands that tell Java how to run your Minecraft server more efficiently. They are like performance settings for the engine that powers your server.

What Problem Are JVM Flags Trying To Solve?

JVM flags are designed to help Java run Minecraft servers more effectively. Right now, Java's default settings run into two major challenges when hosting Minecraft:

  • Minecraft servers can put unusual pressure on the JVM. Defaults are often fine on modern Java, but some servers benefit from garbage collection tuning. That means JVM flags provide specialized garbage collection settings that help Java efficiently manage Minecraft's workload.
  • Java doesn't know what's important for gaming performance. When Java runs with default settings, it doesn't prioritize low-latency operations that Minecraft needs. If it spends time on long garbage collection pauses, it may cause lag spikes and poor player experience.

There's a big computational cost involved in inefficient garbage collection. With JVM flag optimization, servers are less likely to waste resources on preventable lag spikes and memory management issues.

How Are JVM Flags Structured?

JVM flags should be structured and formatted as command-line arguments placed between the java command and your server JAR file.

JVM flags are specialized parameters that use specific prefixes and syntax to control Java's behavior. It's the same format developers use when launching any Java application, and it's directly interpreted by the Java Virtual Machine.

Some common JVM flag elements you'll use in your startup script include:

  • -Xms and -Xmx for memory allocation settings with size suffixes like G for gigabytes
  • -XX:+ for enabling boolean options (the plus sign turns features ON)
  • -XX:- for disabling boolean options (the minus sign turns features OFF)
  • -XX:FlagName=value for setting numeric parameters or string values
  • M or G suffixes to specify megabytes or gigabytes in memory values
  • Multiple flags separated by spaces to create a complete configuration

If your server has specific requirements, you might want to add more flags, using garbage collection tuning parameters, enabling performance logging, or incorporating diagnostic options for troubleshooting.

Here's a simple example following the Aikar's Flags specification:

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -jar paper.jar --nogui

Breaking down the structure:

  • Memory allocation: -Xms10G -Xmx10G sets both initial and maximum heap to 10GB
  • Garbage collector: -XX:+UseG1GC enables the G1 collector
💡
Note: On modern Java, G1GC is usually already the default, so -XX:+UseG1GC often doesn’t change anything by itself, most of the impact comes from heap sizing and the other tuning flags.
  • Performance tuning: -XX:MaxGCPauseMillis=200 targets 200ms maximum pause time
  • G1-specific flags: Multiple -XX:G1* parameters fine-tune garbage collection behavior
  • Server JAR: -jar paper.jar specifies which server software to run
  • Server options: --nogui disables the graphical interface

Should You Use JVM Flags on Your Minecraft Server?

You must set memory (-Xms / -Xmx). Beyond that, extra JVM tuning flags are optional. If you’re on a modern JVM (Java 17/21+), try running with no additional flags first, and only add Aikar’s flags if you actually see garbage-collection related stutters or log evidence.

Paper's developers maintain official documentation stating:

If you have GC problems or are running an older version of Minecraft/an older version of Java, try Aikar’s flags, which are optimized specifically for Minecraft.

Why JVM Flags Aren't Widely Known

The problem is that JVM flags sit in a knowledge gap:

  • Too technical for most server owners: Understanding requires knowledge of Java memory management, garbage collection, and JVM internals
  • Too game-specific for Java documentation: Oracle's documentation targets enterprise developers, not Minecraft hosts
  • Not visible in server dashboards: Unlike RAM usage or TPS, JVM configuration doesn't show up in monitoring tools
  • Works "well enough" to miss: Servers run with defaults. Many owners assume lag is normal or blame other factors

So most server owners either never learn JVM flags exist, see them mentioned but assume they're advanced optional tuning or try to implement them but get overwhelmed by technical documentation.

How To Enable/Disable JVM Flags? (Step by Step)

  1. Navigate to your server directory and find the file that launches your server
  2. Open the file in a text editor
  3. Replace the existing Java command
    1. Find the line that starts with java -jar or similar.
  4. Replace it with your Java command
  5. Adjust memory values
    1. Change -Xms10G and -Xmx10G to match your available RAM:
      1. 8GB system: Use -Xms6G -Xmx6G (leaving 2GB for overhead)
      2. 16GB system: Use -Xms14G -Xmx14G (leaving 2GB for overhead)
      3. 4GB system: Use -Xms3G -Xmx3G (leaving 1GB for overhead)
  6. Save and Test
💡
You can also use start script generator by PaperMC

How to do it on WiseHosting:

  1. Head over to the Game Panel and stop your server.
  2. Navigate to the "Settings -> Startup -> Command" tab.
  1. Here you can find all the configurable JVM flags. There is also a "Recommended" button which automatically applies all the recommended startup parameters to your server.

Join our Discord Server

Talk with the community! Become an official member of the WiseHosting community by joining our public Discord server.

Accept Invite
Discord invite background