“Could not create the Java Virtual Machine” — what it means and the fix

This Java launcher error means the Java runtime refused to even start — before the program (often Minecraft or a Minecraft server) got a single line of its own code run. The usual reasons: the launch command asks for something impossible (too much memory for a 32-bit Java, a garbled argument), or the Java being launched is the wrong one entirely.

What it means

Every Java program starts by creating the Java Virtual Machine with the options in its launch command. If any option is invalid — a memory setting beyond what that Java can allocate, a flag from a different Java version, a corrupted _JAVA_OPTIONS variable — the JVM declines to exist, and this is the message. A second line often follows: “Error: A fatal exception has occurred. Program will exit.”

The fix, in order

  1. Check the memory setting. The classic: -Xmx set higher than a 32-bit Java can address (anything over ~1.5 GB), or higher than the PC's free RAM. In the Minecraft Launcher: Installations → the installation → More Options → JVM Arguments — set -Xmx2G to start. For servers, edit the .bat/.sh start file the same way.
  2. Use 64-bit Java. 32-bit Java caps memory hard and is the root of most “could not create” cases on modern PCs. Install the 64-bit build matching the program (Java 17 or 21 for current Minecraft; Java 8 for old modpacks) from Oracle or Adoptium, and point the launcher at it (Installations → Java Executable).
  3. Remove stray Java option variables. A leftover _JAVA_OPTIONS or JAVA_TOOL_OPTIONS environment variable injects arguments into every Java launch — often set by old guides or other software. Settings → search “environment variables” → delete those two if present (note what they said first), then retry.
  4. Strip custom JVM arguments to defaults. Exotic flags copied from forum posts (GC tuning strings for another Java version) routinely prevent startup. Remove everything except the memory settings and test.
  5. Match the Java version to the program — same family as the JNI error: new Minecraft needs new Java; 1.12-era modpacks need Java 8. A JVM asked to run with another era's flags often fails exactly like this.
Only get Java from Oracle or Adoptium (Eclipse Temurin). And treat any guide whose fix is “set -Xmx to all your RAM” with suspicion — Java needs room outside the heap too; half of physical RAM is a sane ceiling for most setups.

If it still happens

Run the exact launch command in a Command Prompt window instead of through the launcher — Java prints a more specific complaint there (the invalid argument is usually named). If the plain command java -version itself errors, the Java installation is damaged: uninstall all Java versions in Settings → Apps, restart, and install the one correct version cleanly.

Common questions

How much RAM should Minecraft get? For vanilla, 2 GB is genuinely enough. Modded packs commonly need 4–6 GB. More is not always better — oversized heaps on 32-bit Java cause this exact error, and on any Java they can cause stutter.

What is _JAVA_OPTIONS and why would it exist? It's an environment variable that forces options into every Java program. Old tutorials and some workplaces set it years ago; the program it now breaks has no idea it's there — which is why this fix surprises people.

Related errors

A JNI error has occurred · Runtime Error 5 · EADDRINUSE