- How to Fix “Could Not Create the Java Virtual Machine” Error
- Make Sure Java Is Installed Correctly
- Expand Available System Memory for Java
- Run Java As Administrator
- Uninstall and Reinstall Java
- Clearing Up “Could Not Create the Java Virtual Machine”
- FIX: Could Not Create the Java Virtual Machine. (Solved)
- How to FIX: Could Not Create the Java Virtual Machine in Windows 10/11.*
- Method 1. Install the Correct version of JAVA version for Java IDE app*
- Method 2. Increase Allocated Memory for JAVA Apps.
- Method 3. Launch java.exe with Admin rights.
- Method 4. Completely Remove and Reinstall JAVA.
How to Fix “Could Not Create the Java Virtual Machine” Error
If Java is installed correctly on your computer, you should never have any problem running Java-based applications or games.
However, if there’s something wrong with your setup, you may see the error, “Could not create the Java Virtual Machine.” This error means that the Java installation on your computer can’t launch the virtual sandbox (virtual machine) within which it would typically launch the Java app.
In this guide, you’ll learn a few fixes that can eliminate this error, starting with the most common fix to the less likely solution.
Make Sure Java Is Installed Correctly
Before you can troubleshoot any Java errors, you’ll need to ensure that you’ve installed Java correctly.
To do this, open the command prompt by selecting the Start menu, typing cmd, and selecting the Command Prompt app.
In the command prompt window, type java – version and press Enter.
If Java is installed correctly, you should see the version of Java, the SE Runtime Environment, and the Client VM build.
If you don’t have the latest version, you’ll want to make sure to install it. If this looks good, you’re ready to move on to the next troubleshooting step.
Expand Available System Memory for Java
The most common cause for the “Could not create the Java Virtual Machine” error is that Java doesn’t have enough available memory on your system to launch the VM client.
Java is initially set by default to use an initial and maximum “heap size.” So, if you’re running any application that goes beyond the maximum size, it will trigger an error.
You can adjust this by changing the amount of system memory Java can use on your system.
1. Select the Start menu and type environmental variables. Select Edit the System Environment Variables.
2. In the System Properties window, select Environment Variables.
3. Under the System Variables pane, select New.
4. Set the Variable name as _JAVA_OPTIONS and set the Variable value as -Xmx512M.
5. Select OK, and then select OK again.
This adjusts the allowable memory for Java to 512 Mb. The setting change takes effect immediately, so relaunch your Java app and see if the error still appears. If it does, repeat the process above but increase the memory to 1024 Mb by setting the value to -Xmx1024M instead.
Run Java As Administrator
Sometimes virtual machine errors can be caused by the lack of appropriate admin rights on your Windows PC. To see if this is the issue, set up the Java app on your PC to run as the system administrator.
1. Select the Start button and type Java. Select the right arrow next to it and select Open file location.
2. Right-click the Java executable file and select Properties.
3. Select the Compatibility tab and enable the Run the program as an administrator checkbox.
Select OK. Now, the next time Java runs, it will have full administrator rights.
Uninstall and Reinstall Java
Finally, if all else has failed, you may just have a faulty installation of Java.
1. Select the Start menu, type add or remove programs, and select Add or remove programs system settings.
2. In Apps & Features, scroll down to Java, select it, and select Uninstall.
3. Select Yes to confirm, and once Java is fully uninstalled, restart Windows.
4. Download the latest version of Java for your system. Make sure you choose 32 bit if your system is 32 bit or 64 bit if your PC is 64 bit. If you’re not sure which system you have, make sure to check your system type first.
5. Double click the installation file after downloading. Select the Install button to launch the Java installation process.
Walk through the rest of the wizard, and once the Java installation is complete, restart your Windows system.
Clearing Up “Could Not Create the Java Virtual Machine”
Hopefully, you could clear the error in the first few steps and didn’t have to reinstall Java. However, reinstalling Java is a quick enough process and should get your Java apps running smoothly again.
Were there any other fixes you discovered that also worked with this error? Share them with us in the comments section below!
Ryan has been writing how-to and other technology-based articles online since 2007. He has a BSc degree in Electrical Engineering and he’s worked 13 years in automation engineering, 5 years in IT, and now is an Apps Engineer. Read Ryan’s Full Bio
Did you enjoy this tip? If so, check out our YouTube channel from our sister site Online Tech Tips. We cover Windows, Mac, software and apps, and have a bunch of troubleshooting tips and how-to videos. Click the button below to subscribe!
FIX: Could Not Create the Java Virtual Machine. (Solved)
Java is one of the best development tools for creating games and applications and server-side programs. Games or apps written in Java need the Java Virtual Machine environment to run.
Games or applications developed with Java may crash unexpectedly or fail to open for various reasons, displaying the error «Could Not Create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit».
Below you will find several methods to resolve the Java Virtual Machine Launcher error «Could Not Create the Java Virtual Machine», in Windows 10/11 OS.
How to FIX: Could Not Create the Java Virtual Machine in Windows 10/11.*
* Suggestion: Before continuing with the following methods, try the following and see if the problem persists
-
- Install all Windows Updates.
- Press CTRL + SHIFT + ESC to open Task Manager and at Processes tab close all instances of Java Virtual Machine (right-click > End Task)
- 1. Install the Correct version of JAVA version for Java IDE app.
- 2. Increase Allocated Memory for JAVA Apps.
- 3. Launch JAVA with Admin rights.
- 4. Completely Remove and Reinstall JAVA.
Method 1. Install the Correct version of JAVA version for Java IDE app*
* Note: This method only applies to users using a JAVA IDE application for coding.
If you receive the mentioned error on a JAVA IDE application, you must ensure that the installed version of Java is compatible with the Java version (JRE or JDK) is running on JAVA IDE (Java Integrated Development Environment) application. So, proceed as follows:
Step 1. Check the JRE/JDK running version of JAVA IDE.
e.g. In the Eclipse IDE, check which version of the JRE or JDK it is running on by following the steps below:
1. From main menu, click Help > About Eclipse.
2. Click on Installation Details and choose the Configuration tab.
3. In the ‘Eclipse IDE Installation Details’ window, look at the line starting with -vm
4. The value at the line below will show you which JDK or JRE version on which Eclipse is running.- e.g.: If the path contains “jre6”, that means that Eclipse is running JRE version 6
- e.g.:If the path contains «jdk1.8.0_05« means that Eclipse is running JDK version 8.
Step 2. Check which version of JRE or JDK is installed on Windows.
1. In the Search box type: cmd (or command prompt). Then select Run as administrator.
2. To find out the installed JAVA version give the following command and hit Enter:
3. If the IDE does not support the Java version on your device, proceed to install the correct version of Java. *
* Note: In some cases the installed JRE & JDK versions may be different. So, if you JAVA IDE application running on JDK, proceed and check also if the installed JDK matches the running JDK of the JAVA IDE app. To find out the installed JDK version on Windows, give the following command:
Method 2. Increase Allocated Memory for JAVA Apps.
Launching an application that exceeds the maximum memory size of the Java virtual machine could result in the error «Could Not Create the Java Virtual Machine». To work around this problem, go ahead and increase the allocated system memory that JAVA can use as follows:
1. Click on the Start menu and type in search bar: view advanced system settings. Then click Open.
2. In the ‘System Properties’ window, select the Advanced tab and click Environment Variables.
3. Below the System variables pane, select New.
4. Set the Variable name as _JAVA_OPTIONS and the Variable value as -Xmx1024M. Then, click OK twice to save the change and close all open windows. *
* Info: This will adjust the allocated memory for Java to 1GB (1024MB).
5. Restart your machine to apply the change.
6. Finally try to open your game or app on Java Virtual Machine. The problem should be gone.Method 3. Launch java.exe with Admin rights.
The Java error also appears when the user does not have the admin rights or permissions to launch certain executables. Configuring Java to always run as an Administrator could fix the problem.
1. Press the Start menu and type Java in the search box.
2. Click Open file location.3. In the File Explorer window, right-click the Java executable file and select Properties.
4. At ‘java Properties» window select the Compatibility tab and below the Settings pane, check the box Run this program as an administrator. Then click Apply and OK.
5. Finally, start the program that cannot run because of the «Could Not Create the Java Virtual Machine» error and see if the problem persists.
Method 4. Completely Remove and Reinstall JAVA.
In some cases, Java may be corrupted or missing components, causing games or applications you are trying to run to close. In this case, follow the instructions below to remove all versions of JAVA versions from your computer and reinstall it.
1. Download Java Uninstall tool.
2. Run the tool and select to remove all Java versions.3. After removal, proceed and delete the Java folder(s) from the following locations on disk (if exist):
4. Restart your computer.
5. After reboot, visit Java official download page to download and install the latest version of Java.
That’s it! Which method worked for you?
Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.