Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create the Java virtual machine

Tags:

java

linux

jvm

Just be careful. You will get this message if you try to enter a command that doesn't exist, e.g.:

/usr/bin/java -v

I had this issue today, and for me the problem was that I had allocated too much memory:

-Xmx1024M -XX:MaxPermSize=1024m

Once I reduced the PermGen space, everything worked fine:

-Xmx1024M -XX:MaxPermSize=512m

I know that doesn't look like much of a difference, but my machine only has 4GB of RAM, and apparently that was the straw that broke the camel's back. The Java VM was failing immediately upon every action because it was failing to allocate the memory.


Set the JVM memory:

export _JAVA_OPTIONS=-Xmx512M


Make sure the physical available memory is more then VM defined min/max memory.


The problem got resolved when I edited the file /etc/bashrc with same contents as in /etc/profiles and in /etc/profiles.d/limits.sh and did a re-login.