Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create java VM --- how do I get more verbose error messages?

I am using java "1.6.0_24" OpenJDK. Sometimes when I run my program, all that I get is a message

Could not create the Java virtual machine.".

Some other times, the program runs perfectly fine.

Is there some set of options that I can add to get more verbose output as to the exact error (maybe even something similar to a core dump?).

This is probably not related to the heap size since in that case, it does give a definite and clear error message like :-

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

This I could fix with setting -Xms and -Xmx appropriately. However, the JVM quitting without printing anything else at all is very unhelpful.

Just to clarify, my question is about coaxing more verbose error messages or some sort of status files / core dumps which I can then use for debugging.

like image 834
owagh Avatar asked Nov 12 '22 04:11

owagh


1 Answers

Start with a small heap. Set -Xms far lower than -Xmx. Increase the maximum heap size, -Xmx to some 1024(or 2048 depending on your application). Set -Xms to some 512 (I'd say half of Xmx)

like image 134
Aneesh Vijendran Avatar answered Nov 14 '22 22:11

Aneesh Vijendran