I have a VPS (Linux Server) where I downloaded a 64-bit version of Java. On my terminal, I am able to run commands such as:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java -version
And receive the following output:
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed
So to test this for my website, I used the following php:
<?php
$output = array();
exec('/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java -version', $output);
foreach($output as $line) {
echo $line;
echo '<br/>';
}
?>
But receive the following error:
Error occurred during initialization of VM
Could not allocate metaspace: 1073741824 bytes
So far I have tried the following:
1) I've updated permissions on java so that:
stat -c "%a %n" /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java
Returns:
755 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java
2) I've turned php safe-mode off
3) I've changed the max memory in my php.ini file to 1.5GB
What causes this error and how do I get the java program to run without error?