Oftentimes, you might get an error saying ‘could not create the java virtual machine’ when you try to open any application that uses java. There are a few reasons that can cause this problem. However, the most common issue is the low memory allocated to the program for execution. Accordingly, you might face this error while trying to open an open-source application or a homemade application. Other times, Java may not have the required administrative privileges to run the application properly.
Methods to Resolve ‘Could Not Create The Java Virtual Machine’ Error
There are a few effective ways to get rid of this problem. Here, we have discussed all the ways in the following section. Thus, go through these steps accordingly to fix the error effortlessly.
Solution 1: Allocate More Memory Space to Java
Incidentally, Java is allocated only up to 64 MB by default. Therefore, you may get the ‘Could not create the Java virtual machine’ problem if the application needs more than 64 mb of memory. Hence, you need to increase the maximum memory for Java by following the given steps.
- First, press the Windows key and ‘R’ at the same time on your keyboard. This will launch the Run dialogue box.
- After that, type “sysdm.cpl” in the text field and then tap on the OK option.
- Then, go to the Advanced tab and click on the Environment Variables button.
- After that, navigate to the System Variables box and tap on the New button.
- Head over to the Variable name text box to type ‘_JAVA_OPTIONS’.
- Thereafter, you need to type ‘-Xmx512M’. This will help you to increase the memory space allotment to 512 megabytes.
- Now, close the window and for that select the OK option.
- Finally, go to the Environmental windows and then tap on the OK button.
Solution 2: Grant Admin Rights to Java.EXE
As stated earlier, you may face this issue if the Java application doesn’t have the necessary admin rights. Thus, you can resolve this problem by performing the below-mentioned steps.
- Initially, launch the File Explorer by pressing the Windows logo key with the letter ‘E’ at the same time.
- Next, head over to the main directory where Java is installed. There, find and locate the java.exe file. You can find this application in Program Files/Java/*JRE build version*/bin. However, it depends on which Java Runtime Environment you want to optimize.
- Right click on the file and select the Properties option.
- After that, navigate to the Compatibility tab and check the option for “Run this program as an administrator”.
- Now, save the changes by clicking on the Apply and then on the Ok option.
- Select the application that caused the error and do the same.
Finally, you need to run the application and check whether the error message has been fixed or not.
Solution 3: Reinstall Java
As a last alternative, you can try to fix the problem by reinstall Java. Thus, follow the steps given below to reinstall Java.
- First, you have to uninstall the current Java version. For that, go to the Run dialog box by pressing the Windows logo button with the letter ‘R’.
- Next, type ‘appwiz.cpl’ and press the Enter key to launch the Programs & Features window.
- After that, navigate to the search box to enter ‘Java’.
- Next, click on Java and follow the Uninstall instructions. If asked for any confirmation, simply click on the Yes option.
- Finally, restart your Windows system. After restarting, open any browser and visit the official website of Java.
- There, select your system type and download the correct software for your Windows operating system version. Make sure you have chosen 32 bit or 64 bit according to your system type.
- Now, run the downloaded Java setup wizard as an Administrator by right clicking on it. Next, follow the instructions as displayed and complete the installation procedure for Java.
Thereafter, try to launch the program once again. Check if the error message is still appearing or not.
Lastly, you should be able to get rid of the ‘could not create the java virtual machine’ error message by following the above steps. Generally, allocating a larger memory space helps to resolve the issue without any hassle. You can even try to increase this size if you are still facing the problem. Alternatively, you can hope to resolve the issue by performing a clean reinstallation of Java.