How to Fix “Could Not Create the Java Virtual Machine” Error

From the most common to the less likely

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 theStartmenu, typingcmd, and selecting theCommand Promptapp.

In the command prompt window, typejava – versionand pressEnter.

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 toinstall 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. SelectEdit the System Environment Variables.

  2. In the System Properties window, selectEnvironment Variables.

  3. Under the System Variables pane, selectNew.

  4. Set the Variable name as_JAVA_OPTIONSand set the Variable value as-Xmx512M.

  5. SelectOK, and then selectOKagain.

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-Xmx1024Minstead.

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 torun as the system administrator.

  1. Select the Start button and typeJava. Select the right arrow next to it and selectOpen file location.

  2. Right-click the Java executable file and selectProperties.

  3. Select theCompatibilitytab and enable theRun the program as an administratorcheckbox.

SelectOK. 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, typeadd or remove programs, and selectAdd or remove programssystem settings.

  2. In Apps & Features, scroll down toJava, select it, and selectUninstall.

  3. SelectYesto confirm, and onceJava is fully uninstalled, restart Windows.

4.Download the latest version of Javafor 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 tocheck your system type first.

  1. Double click the installation file after downloading. Select theInstallbutton 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

Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.

HomeAbout UsEditorial StandardsContact UsTerms of Use

Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved