Shell_exec() on java

I was able to execute a java application on SSH. But when I tried to execute it using shell_exec() in PHP through web browser, it gave me this error message instead of correct output.

Error occurred during initialization of VM Could not reserve enough space for code cache Does anyone know how to resolve this error? I appreciate any help or comment. Thanks.