Calling Java from PHP

I am trying to invoke a Java command from a PHP script (called via HTTP, not via the command line) using the system() function. However I am getting an error every time, saying:

Error occurred during initialization of VM
Could not reserve enough space for code cache

I even get this error when doing something very simple such as:

<?php system('java -version'); ?>

Is there some setting required to get a JVM up and running from a PHP script, or is this kind of thing simply not supported?