There are many computer applications developed based on Java. When users run these applications, they are supposed to run smoothly. However, in some instances, errors can pop up and terminate the launch of the respective software. This is usually happening by displaying the error message that starts with ‘could not create the Java virtual machine …’. If you see this message, the next thing you would experience is that the Java program is stopped. Well, have you ever experienced this error ‘could not create the Java virtual machine …’ error? If so, this article explains the fixes to it. So, read on.
PS: learn more about how to fix ‘stuck with 0x80070422 error code in Windows update‘, and the ‘bad system config info Windows 10‘, as well as the ‘your Windows license will expire soon‘ easily.
What causes ‘could not create the Java virtual machine’ error?
There are several causes behind this issue. Mentioned below are some of those reasons.
- If Java is invoked with the wrong arguments
Or if you use unstable software (be it a game or any other app), this issue can occur.
- If Java global maximum heap memory is not high enough
This is among the most common causes for sure. In this case, you will have to allocate more memory to resolve the issue.
- If Java executable file and application is not granted administrative privileges
To solve this, you should provide administrative privileges.
Besides, if you are bothered with the issue of the could not find or load the main class, click to fix it now.
How to fix ‘Could not create the Java virtual machine’ error?
As emphasized in the first paragraph of this article, we are going to explain how to fix this error. In fact, there are multiple solutions to this error so you should pick the most appropriate one for you. Let’s read on.
Fix 01: Configure a new system variable
Configuring a new system variable for Java is our first solution to this error. ‘Could not create the Java virtual machine’ error actually appear when there is not enough memory for it. In other words, Java requires a substantial amount of memory, and when there is not enough memory, it stops. That means, some of the machines that have larger memory capacity experience this issue rarer compared to other machines. Some of the users have found a solution to this issue simply by expanding the RAM allocated to Java. Well, to allocate more memory to Java, you may try the following steps and get it done. We use this option as the first method because it is a very easy process.
Steps to configure a new system variable
- As the first step, you should open the ‘Run‘ command in your computer. To do this, there are a couple of ways. You can hit Window key and ‘R’ key on the keyboard simultaneously to get ‘Run‘ dialog box opened. If not, you can hit Windows key and type ‘Run‘ in the search box and select the ‘Run’ option.
- No matter which method you select, just go to ‘Run.’ Once the ‘Run‘ dialog box is opened, you will see a search bar as well. In this search bar, enter the text’ sysdm.cpl‘. Then, press the button labeled ‘OK.’ You will now see a different window. This Window will comprise the title ‘System Properties.’
- On this Window called ‘System Properties,’ you should select the tap labeled ‘Advanced‘ tab. Under this option, you will find a button called ‘Environment Variables.’ This will lead you to another window.
- Click on the option labeled ‘New‘ which is located under ‘System variables.’
- Now, you should enter ‘_JAVA_OPTIONS.’ This should be entered inside the Variable name text box.
- After that, you should enter ‘_Xmx512M‘ within the Variable value text box. Well, this option will increase RAM allocation by 512 megabytes.
- Now, to complete the process, you should click on the ‘OK‘ button.
- Thereafter, you can press the ‘OK‘ button on the ‘Environmental Windows‘ as well.
- That’s it, and 512MB RAM will be allocated.
Fix 02: Make ‘Run’ as an Administrator Option for Java
If the previous option doesn’t work for you, you will have to try a different option. If it doesn’t work, that means, the error might be something else. In fact, ‘Could not create the Java virtual machine …’ can occur due to insufficient admin rights to Java. If you are using Windows 10, you can fix the issue using the following steps.
- In Windows 10, you should open Cortana. To do this, you should hit Windows Key with ‘Q‘ key on the keyboard.
- Now, you will see a search box appearing. In this box, enter ‘Java.’
- Then, you will be able to see the ‘Java‘ option. Right-click on this option and then select the option called ‘Open File Location.’
- This option will open the folder of Java in the File Explorer window.
- You can now go to the java.exe file and then right-click on it. You will then be able to select the ‘Properties‘ option.
- Then select the tab labeled ‘Compatibility.’
- After selecting the ‘Compatibility‘ option, you should select ‘Run this program as an administrator.‘
- To complete the process, you should select the option called ‘Apply.’
- Click ‘OK‘ so you can finish the process.
Also, let’s figure out what to do if Javaw.exe is missing.
Fix 03: Install Java once again
If none of the above options have worked so far, the cause of the issue might be something different. So, as another remedy, you should try to reinstall Java and check if it resolved the issue. After reinstalling Java, you can expect ‘Could not create the Java virtual machine‘ error to be gone.
So, to get it done, you should first uninstall the existing version of Java. For that, you must go to control panel of the machine. To access the control panel, there are several options you can consider. For instance, you can either choose a long way or a shortcut. As we believe, entering the text ‘appwiz.cpl.’ within ‘Run‘ box is the most convenient way.
Steps to Reinstall Java
- Then, in the search box, you should enter ‘Java.’ If not, you can simply scroll down until you find the option called ‘Java.’
- Now, select the option labeled ‘Java‘ and then click on ‘Uninstall.’
- You may now click on ‘Yes‘ on the confirmation box which will popup.
- Now, restart Windows computer after the installation.
- Open a web browser of your preference and go to the Java download page.
- Make sure you choose the appropriate software version for the operating system running on your computer. For instance, if you have 32-bit Windows OS, you should choose the 32-bit Java file. However, if the operating system runs on 64-bit, you should choose the 64-bit version accordingly. If you are doubtful about the version, you may try installing both of the Java files. To do this, you should go to the Windows Offline file.
- No matter whether you have selected 32-bit version or 64-bit version, you must open Java setup wizard now.
- Click on the option labeled ‘Install‘ which appears as a button on this setup wizard you have just launched.
Well, that is exactly how to fix the ‘Could not create the Java virtual machine ….’ Issue. This is also known as Java Virtual Machine fatal error. As we believe, the resolutions we have mentioned above can address this issue for good. Once the issue is fixed, you will be able to run the required Java software without any issue.