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!
For more information please see the list of Error could not create the java virtual machine