Thursday, October 3, 2013

Error occurred during initialization of VM / Could not reserve enough space for object heap

If you are getting below error while running a java program, possible reason could be JVM is running in another bit mode (32 bit OR 64 bit)

Error occurred during initialization of VM
Could not reserve enough space for object heap

Solution - Check out in which bit mode your JVM is running. you can use below command to find out in which bit mode your JVM is running.

java -d32 -version OR java -d64 -version

Find the line that executes the java command and add correct bit mode. For example ' -d64 ' to the java command line. This is a flag that forces the Java virtual machine to run in 64 bit mode.