How to Add JVM Arguments to Minecraft (Guide)

Add JVM arguments to Minecraft by editing the JVM arguments field in your launcher's profile. Step by step, with the safe -Xmx heap setting and common fixes.

Guidesby trqUpdated June 4, 2026
Key takeaways
  • JVM arguments live in your launcher's profile, not in the in-game options.
  • They configure the Java runtime that hosts the game, so a typo affects startup, not your world.
  • The flag most players want is -Xmx, which caps how much memory the game can use.
  • For most setups, 4 to 6 gigabytes is plenty. More can make stutter worse.

You add JVM arguments to Minecraft in your launcher's profile settings. Open the profile you launch with, find the JVM arguments field, and edit the space separated list of flags there. These flags configure the Java virtual machine that hosts the game, not the game itself, so a typo affects startup, not your world.

Where Opal fits

Opal is a Fabric mod, so it shares the same JVM arguments as the game it runs inside. For the version it targets and the exact setup, follow the setup guide.

What a JVM argument is

A JVM argument is a flag you pass to the Java runtime when it starts the game. The launcher builds a long command line every time you press play, and the JVM arguments are the part of that line that tunes the runtime. The most common one sets how much memory the game can use.

These flags are not Minecraft settings. They are read by the JVM before the game even loads, which is why you set them in the launcher and not in the in-game options menu.

Where to put them

Almost every launcher keeps a JVM arguments field inside each profile. The label varies, but the location is consistent.

Launcher typeWhere the field lives
The official launcherInstallations, edit a profile, More Options, JVM Arguments
A third-party launcherProfile or instance settings, often under a Java or Advanced tab
Command line / scriptsThe java command you run, before -jar

Edit the existing list rather than replacing it. Launchers ship sensible defaults, and wiping them can break startup.

Step by step in the official launcher

1

Open Installations

Open the launcher and go to Installations.

2

Edit your profile

Hover the profile you use and click the edit (pencil) icon.

3

Open More Options

Open More Options. A JVM Arguments box appears.

4

Edit the flags

Edit the flags in that box. They are separated by spaces.

5

Save and launch

Save, then launch that profile.

The argument most people want: heap size

The flag most players come for is -Xmx, which caps the maximum heap the JVM may use. -Xmx4G allows up to 4 gigabytes. There is also -Xms, the starting heap.

-Xmx4G -Xms2G

Two rules keep this safe. Do not allocate more than you have free, because the Java process needs headroom and the operating system needs the rest. More is also not always better; very large heaps can make garbage collection pauses worse, not smaller. For most setups, 4 to 6 gigabytes is plenty.

Common flags you will see

  • -Xmx<size> sets the maximum heap, for example -Xmx4G.
  • -Xms<size> sets the starting heap, for example -Xms2G.
  • -XX:+UseG1GC selects the G1 garbage collector, a common default.
  • -Dproperty=value sets a system property the game or a mod reads at startup.

You rarely need more than the heap flags. Long copy-pasted argument lists from old guides often hurt more than they help on a modern Java runtime.

When something goes wrong

  • Game will not start after editing: a typo in the flags. Restore the default arguments and re-add changes one at a time.
  • -Xmx is ignored or errors out: wrong unit or syntax. Use G or M with no space, as in -Xmx4G, not -Xmx 4 GB.
  • Stutter got worse after raising memory: too large a heap can lengthen garbage-collection pauses. Lower -Xmx back toward 4 to 6 gigabytes.

FAQ