Centos – can’t start tomcat on vps – java VM error “could not reserve enough space for object heap”

centossshtomcat6

I can't start tomcat6 on my VPS (which has 256 MB, 512 MB burst and uses currently only 20MB of it). the log entry shows:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

i read that i can set the min and max heapsizes for the java with the -Xms and -Xmx
what do i need to do that tomcat will pass these parameters to java when trying to start the service?

Best Answer

edit /etc/default/tomcat6 and add in -Xms and -Xmx values to java opts there.

eg:- JAVA_OPTS=" -Xmx256m"