Could not create the Java Virtual Machine: Fixes for Windows, Eclipse, Minecraft

If you have encountered the ‘Could not create the Java Virtual Machine’ error when trying to launch an application using Java, you are not alone. Many users have reported this error when launching Minecraft, Eclipse, and other applications. This troubleshooting guide will look into the reasons for this error and provide step-by-step solutions to fix this problem. You will find solutions for both Windows and macOS. 

What is Java?

Java is a programming language that has remained popular since its release in 1995. Java had a significant market share in the early 2000s but has been in a slow decline as Python and JavaScript grow ever more popular. Despite this decline, Java is used for a wide range of applications, including mobile and desktop applications. Any Java application only needs to be programmed once, and then it can easily run on different platforms, a characteristic called Write Once Run Anywhere.

Java Virtual Machine (JVP) is an important component of the Java programming language. The Java source code (.java file) needs to be compiled by a tool called javac into Byte Code (binary form). Then Java Virtual Machine acts as the Byte Code interpreter and will convert the code into the necessary machine language. The Java Virtual Machine is part of the Java Runtime Environment, also known as JRE. 

The process proceeds like this:

  1. Write Java source code. (.java)
  2. Java is compiled by javac.
  3. Java is now in the form of Byte Code.
  4. Byte Code interpreted by Java Virtual Machine.

What does the ‘Could not create the Java Virtual Machine’ error mean?

It’s obvious how important Java Virtual Machine is for Java applications to run correctly. Java Virtual Machine is responsible for many tasks, including:

  • Loading Java code
  • Verifying the code
  • Executing the code
  • Report fatal errors
  • Provides run-time environment

The ‘Could not create the Java Virtual Machine’ error is a Java Virtual Machine error. This error means that the computer has issues opening the Java Virtual Machine. You will be unable to proceed with using the Java application or executable until you resolve this error. Continue reading to learn more about the causes and solutions to this bothersome error message. 

Could not create the Java Virtual Machine error message on Windows

What causes the ‘Could not create the Java Virtual Machine’ error?

The ‘Could not create the Java Virtual Machine’ error can typically be attributed to incorrect code, even just an incorrectly placed semicolon, but may also be related to:

  • Administrator privileges – some Java applications require administrative privileges to function correctly
  • Incorrect SDK (software development kit)
  • Incorrect environment variables
  • Memory management errors – maximum heap memory larger than System Variable setting
  • Missing IDE libraries

Solutions to fix the ‘Could not create Java Virtual Machine’ error

The solutions within this guide are primarily aimed at Windows users. Windows users report this issue much more frequently, and most MacOS users that report this error report it in relation to Eclipse. 

Following the Windows solutions, you will find a footnote about fixing the ‘Could not create Java Virtual Machine’ error if encountered with macOS. You will be directed back to the Windows solution because the process is the same.

Windows Solutions

1. Edit System Variables (Fixes Minecraft Error)

System Variables are key-value pairs that pass on configuration information to applications. Users experiencing the ‘Could not create Java Virtual Machine’ error have reported success in solving this error by creating a new System Variable. This variable will set the global maximum heap memory size and prevent memory mismanagement errors. 

Many Minecraft players have recorded the same JVM error when trying to launch their game. If this is happening to you, it’s related to your Java installation, not the Minecraft application. Users have reported that the system variable adjustment to fix memory mismanagement solves this problem. 

To create a new System Variable to increase the size of the global maximum heap memory size for Java, follow the steps below:

  1. Press Windows key + R, and the Run dialog box will open. Enter “sysdm.cpl” into the search box and press Enter.
Open sysdm.cpl
  1. The System Properties window will open. Select the Advanced tab and then Environment Variables.
Environment variables
  1. From the Environment Variables window, under System Variables, select New.
Create new system variable
  1. A new window will open. For Variable name, enter _JAVA_OPTIONS and set Variable value to –Xmx512M. The Xmx512M setting will allocate 512 Megabytes of RAM to global maximum heap memory. Click OK.
New Java options system variable –Xmx512M
  1. Close all windows and restart your system. Then attempt to open the application like Minecraft that was displaying the ‘Could not create the Java Virtual Machine’ error to see if the problem is resolved.

2. Administrator Privileges 

Assigning administrator rights to the main Java executable has successfully fixed this error for many users.

  1. Press the Windows key and enter “Java” into the search bar. 
  2. Select Open file location to navigate to Java’s location in File Explorer. If this brings you to the location of a shortcut, you may need to navigate to the executable yourself. Typically you can find the java.exe at this location: 
    C:\Program Files (x86)\Java\jre1.8.0_321\bin
Java open file location
Java folder
  1. Right-click on the Java executable, java.exe. Select Properties from the drop-down list. 
  2. In the java.exe Properties window, select the Compatibility tab.
Run Java as administrator to avoid getting the ‘Could not create the Java Virtual Machine’ error message
  1. Under the Settings heading, select the Run this program as an administrator option.
  2. Then click Apply, followed by OK, to save the changes. Close any open windows. Restart your machine and then attempt to reopen the Java application that was the problem.

3. Reinstall Java

You may also opt to reinstall Java to rule out any issues with your version or installation. Some users have reported that this quickly and easily fixed the ‘Could not create Java Virtual Machine’ error. 

To reinstall Java:

  1. Begin by uninstalling the current version of Java. Press the Windows key and enter “uninstall” into the search bar.
  2.  Locate Add or remove programs and select Open.
Uninstall Java
  1. The Programs and Features or Apps and Features (Windows 11) window will open. Scroll through the applications or use the search box to filter by Java.  
  2. Select Java and click Uninstall. If a window opens asking for confirmation to Uninstall, select Yes.
  3. After the application has been uninstalled, restart your system. 
  4. Open your browser and navigate to the Java download page for Windows. Click Agree and Start Free Download if you want to install the latest version of Java.
Download Java for Windows
  1. Select the save location for the JavaSetup executable and then start the installation. Follow any installation prompts. After the installation is complete, attempt to open the Java application that displayed the ‘Could not create Java Virtual Machine’ error to see if the error is resolved.
Reinstalling Java can resolve the ‘Could not create the Java Virtual Machine’ issue

4. Edit eclipse.ini file

Eclipse is a popular IDE (integrated development environment) used for the development of Java applications. If you are using Eclipse to create or change a Java application and cannot create the Java Virtual Machine, you can try to edit the Eclipse.ini file. 

Warning: Back up the eclipse.ini file before making any changes. 

Fix global maximum heap memory size incompatibility

  1. Open the eclipse.ini file in Notepad (or another text editor) from within the Eclipse IDE folder. 
eclipse.ini in folder
  1. Locate the line:
    –Xmx256m (maybe a different number than 256)
Editing eclipse.ini to fix the ‘Could not create the Java Virtual Machine’ error
  1. Increase the maximum heap memory size, staying within a reasonable value for your computer’s RAM:
  2. Provide the exact version of Java installed, as well. Like this:
  3. Save the file and attempt to open the application again or continue to the next edit.

Adjust JVM

Adjust the settings for the Java Virtual Machine within the eclipse.ini file. Be aware that the version and file locations may differ for your machine and Java version:

  1. Remove the line pointing to the virtual machine:
    -vm P:\Programs\jdk1.6\bin
  2. Set -Dosgi.requiredJavaVersion=1.5 to:
    set -Dosgi.requiredJavaVersion=1.6
  3. Add a new line above the -vmargs! Line:
    -vm C:\Program Files (x86)\Java\jre6\bin\javaw.exe
  4. Add a line that points to JVM.dll:
    C:\Program Files\Java\jre7\bin\client\jvm.dll
  5. Save the eclipse.ini file and attempt to see if the problem is resolved. 

Remove eclipse.ini file

Some users have reported success with deleting the eclipse.ini file completely. Copy the file and save it elsewhere, outside of the Eclipse folder. Next time when you open Eclipse, the application will recreate the eclipse.ini file.


1. Edit eclipse.ini file

The Eclipse error that troubles Windows users also occurs on macOS. To fix this error on macOS, you will need to follow the exact same steps from the Windows solution above. You will have different file locations, but the process of editing the eclipse.ini file is the same. 

This solution is so effective because it solves the problem of multiple Java versions. When multiple Java versions are installed, your system doesn’t know which JVM to use. By editing the eclipse.ini file in this manner, you are explicitly stating the version of Java and JVM you need to use. 

Eclipse failed to create Java Virtual Machine on macOS

Solved: ‘Could not create the Java Virtual Machine’ error fixed

This troubleshooting guide has provided you with four solutions to the ‘Could not create the Java Virtual Machine’ error. This error may be due to coding mistakes but is also commonly reported when Java doesn’t have administrator privileges, has memory mismanagement, and for applications such as Minecraft and Eclipse. 

If you followed this guide, you’ve learned more about Java and the importance of the Java Virtual Machine. Hopefully, the solutions within this guide have solved the error, and you are back to developing or enjoying your game without issue.

Leave a Comment