Fix ‘Could Not Create the Java Virtual Machine’ Error (Minecraft)

Could not create the Java Virtual Machine is the error Minecraft and other Java programs show when Java is started with settings it cannot accept. Here are seven fixes.

Quick answer

“Could not create the Java Virtual Machine” means Java was told to start with settings it cannot accept. In Minecraft it is nearly always a memory value that is too high for the Java you have, or a typing mistake in the JVM arguments.

  1. Open the Minecraft Launcher and go to Installations.
  2. Hover over your installation, click the three dots, then Edit > More options.
  3. In JVM arguments, change the first part to -Xmx2G and click Save.
  4. Start the game. If it works, raise the value using the picker below.

Minecraft Memory Picker

Get a safe -Xmx value for your PC. Find your RAM in Settings > System > About.

Chart of how much memory to give Minecraft with the -Xmx setting for 4, 8 and 16 GB of RAM
Save this chart: safe -Xmx values by RAM.

The 7 fixes

1 minuteStart here

Fix 1: Lower the memory setting

Follow the quick answer. -Xmx is the most memory Java may use. The error appears when that number is larger than Java can reserve.

  • Write it with no spaces: -Xmx4G is right. “-Xmx 4G” and “-Xmx4GB” are wrong.
  • If there is also an -Xms value (starting memory), it must be the same as or lower than -Xmx.

Worked if: the launcher starts the game instead of showing the error box.

2 minutes

Fix 2: Fix the JVM arguments

One wrong character stops Java from starting. If you or a guide edited the arguments, reset them:

  1. In the launcher: Installations > Edit > More options.
  2. Delete everything in JVM arguments and save. The launcher puts its defaults back.
  3. Test the game, then change only the -Xmx part.

Options copied from old guides are a common cause. Newer Java versions have removed some of them and refuse to start when they see one.

5 minutes

Fix 3: Install 64-bit Java

Check which Java you have. Open Terminal and run:

java -version

If the last line does not say 64-Bit, you have 32-bit Java, which cannot reserve more than about 1 GB. Uninstall it in Settings > Apps > Installed apps, then install a 64-bit build from Adoptium or java.com.

The official Minecraft Launcher brings its own 64-bit Java. If “java” is not recognized as a command, that is fine for the official launcher. Third-party launchers and servers need Java installed.

Fix 4: Use the right Java version

Minecraft versionJava needed
1.20.5 and newerJava 21
1.18 to 1.20.4Java 17
1.17Java 16
1.16.5 and olderJava 8

Old modpacks on Java 8 often carry arguments that newer Java rejects, and the reverse. In the launcher you can point one installation at a specific Java under More options > Java executable.

Advanced

Fix 5: Set the memory for all Java programs

For Java programs with no settings screen of their own:

  1. Open Start and search Edit the system environment variables.
  2. Click Environment Variables. Under System variables click New.
  3. Name: _JAVA_OPTIONS. Value: -Xmx512M. Click OK on every window.
  4. Close and reopen the program.

This caps every Java program on the PC, Minecraft included. If the variable already exists with a large value, it may be the cause of your error. Lower it or delete it.

Fix 6: Free up memory

Java needs the whole amount free at the moment it starts. Close browsers and other games, then try again. In Task Manager > Performance > Memory, “Available” should be larger than your -Xmx value.

Fix 7: Reinstall the launcher

If a clean installation profile still fails, uninstall the Minecraft Launcher in Settings > Apps, restart, and install it again from the Microsoft Store or minecraft.net. Your worlds are stored separately in the .minecraft folder and stay.

What the other lines of the error mean

Line in the errorMeaningFix
Could not reserve enough space for object heap-Xmx is too highFix 1 or 3
Invalid maximum heap size-Xmx is written wrongly, or too big for 32-bitFix 1 or 3
Unrecognized option, or Unrecognized VM optionAn argument this Java does not knowFix 2 or 4
Initial heap size set to a larger value than the maximum-Xms is bigger than -XmxFix 1

What we did not test

Java and Minecraft are not installed on our test PC, so we did not trigger this error ourselves. The memory values in the picker are a simple rule: about half the RAM, capped at 8 GB, and 1 GB for 32-bit Java. They are a safe starting point, not a measured optimum for your mods.

Which fix worked for you?

One tap. It helps the next reader start with the right fix.

Frequently asked questions

What causes “Could not create the Java Virtual Machine”?

Java was started with a memory size it cannot reserve, or with an option it does not recognize.

How much RAM should I give Minecraft?

About half of your RAM, and usually no more than 8 GB. On an 8 GB PC use -Xmx4G.

Do I need to install Java for Minecraft?

Not for the official launcher. It includes its own Java. Third-party launchers and servers need a separate install.

Why does 32-bit Java cause this error?

A 32-bit program can only address a limited amount of memory, so a request above about 1 GB fails.

More Windows You May Like

Leave a Reply

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