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.
“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.
- Open the Minecraft Launcher and go to Installations.
- Hover over your installation, click the three dots, then Edit > More options.
- In JVM arguments, change the first part to -Xmx2G and click Save.
- 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.

The 7 fixes
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.
Fix 2: Fix the JVM arguments
One wrong character stops Java from starting. If you or a guide edited the arguments, reset them:
- In the launcher: Installations > Edit > More options.
- Delete everything in JVM arguments and save. The launcher puts its defaults back.
- 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.
Fix 3: Install 64-bit Java
Check which Java you have. Open Terminal and run:
java -versionIf 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 version | Java needed |
|---|---|
| 1.20.5 and newer | Java 21 |
| 1.18 to 1.20.4 | Java 17 |
| 1.17 | Java 16 |
| 1.16.5 and older | Java 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.
Fix 5: Set the memory for all Java programs
For Java programs with no settings screen of their own:
- Open Start and search Edit the system environment variables.
- Click Environment Variables. Under System variables click New.
- Name: _JAVA_OPTIONS. Value: -Xmx512M. Click OK on every window.
- 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 error | Meaning | Fix |
|---|---|---|
| Could not reserve enough space for object heap | -Xmx is too high | Fix 1 or 3 |
| Invalid maximum heap size | -Xmx is written wrongly, or too big for 32-bit | Fix 1 or 3 |
| Unrecognized option, or Unrecognized VM option | An argument this Java does not know | Fix 2 or 4 |
| Initial heap size set to a larger value than the maximum | -Xms is bigger than -Xmx | Fix 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.
Axee Davies is the founder of AxeeTech, publishing gaming guides, codes, and Windows how-tos since March 2013. A tech enthusiast for 13+ years — starting with smartphones and Android rooting — he now runs a site that puts out a new guide every day for Roblox players, traders, and Windows users. More about AxeeTech
More Windows You May Like
How to Fix samsung notes pc error sa_1036 on Windows
How to Save a Webpage to Desktop: Chrome, Edge & Firefox
How to Find Windows Product Key: 4 Easy Ways (Win 11)
How to Change Password Windows 11: Easy Steps + PIN
How to Check Windows Version: 5 Easy Ways (Win 11/10)
Startup Apps in Windows 11: Easy Ways to Turn Them Off
How to Uninstall Programs in Windows 11: 5 Easy Ways
How to Check RAM in Windows 11: Easy, Quick Guide