Invalid initial heap size. Could not create the Java virtual machine
This is your problem
Invalid initial heap size: -Xms256m -Xmx512m -XX:MaxPermSize=256m
Some systems ( May be windows JRE) understands Xms
and Xmx
values given in small letters. here 256m and 512m denotes 256MB and 512MB respectively .
Some machine(JDK 1.7 on Ubuntu ) doesn't understand small m for MB
. So when I changed Xms256m -Xmx512m , to =>
Xms256M -Xmx512M , it started working .
P.S -> I got this error while installing IntelliJ on Ubuntu 15 ( JDK 1.7) , I edited
/bin/idea.vmoptions
file of intelliJ and It started working.Here is a list of error you can get for wrongly setting Xmx and Xms values -
java -Xmx4056M -Xms4056M HelloWorld
Issue: Error occurred during initialization of VM , The size of the object heap + VM data exceeds the maximum representable size
Cause: the value of either -Xms or -Xmx is higher than or close to the size of physical memory, as my machine has 4GB memory.
java -Xmx1056M -Xms2056M HelloWorld
Issue: Error occurred during initialization of VM , Incompatible minimum, and maximum heap sizes specified
Cause: value of -Xms is higher than -Xmx
java -Xms2056M HelloWorld
Issue: Error occurred during initialization of VM , Could not reserve enough space for object heap
Cause: Only -Xms was provided and -Xmx was not provided. you will also get this error if you have a typo and instead of -Xmx you have specified -Xms two times
java -Xms1024 M -Xmx1024M HelloWorld
Issue: Error occurred during initialization of VM , Too small initial heap
Cause: If you had space between 1024 and M than JVM assumes the size of -Xms as 1024 bytes only and print error that it's too small for JVM to start
got the correct parameters(JAVA_OPTS) from here. I've set them in setenv.bat.
This problem happened to me while trying to run Cassandra.
Uninstalling Java 32-bit and installing Java 64-bit solved this problem for me.