How to resolve could not create the Java Virtual Machine error in Visual Studio 2015 Apache Cordova 5.1.1?

Ashok Raja
 
Solutions Architect
August 17, 2015
 
Rate this article
 
Views
2317

You may encounter this type of java related virtual machine errors while you upgrade from cordova 4.3.1 to cordova 5.1.1 in Tools for Apache Cordova project of visual studio 2015 in a 64 bit machine. Some of the common errors associated with upgrade of cordova are “Could not create the Java Virtual Machine”, “Error occurred during initialization of VM” and “could not reserve enough space for object heap”.

The above errors are intermittent of nature and occurs particularly in a 64 bit development environment. At times it may work after a re-start of your machine and it may fail at any point of time while you build the apk targeting device or emulator.

This issue is related to 32 bit version of jdk that’s been installed as a part of Visual Studio 2015. The easiest way to fix this issue is to download the 64 bit version of jdk and map the path of installation directory to visual studio.

clip_image002

The other alternative option is to set a _JAVA_OPTIONS environment variable which doesn’t seems to work as expected. You have to play around with the memory allocation in this option and may not be a good idea to change that unless you are sure on what you are doing.

Author Info

Ashok Raja
 
Solutions Architect
 
Rate this article
 
I am Ashok Raja, Share Point Consultant and Architect based out of Chennai, India. ...read more
 

Leave a comment