如何在 php 中执行 jar 文件


How to execute jar file in php

我读了很多关于这个的内容,但我的问题仍然存在:

我想做的是:

echo shell_exec("/usr/bin/nohup /usr/bin/java -Xmx1g -jar /var/www/html/myDir/ff.jar &");

它给了我这个错误:

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

我使用nohup因为即使 PHP 终止,jar 也必须运行。

可能是什么问题?

您是否在运行它的机器上启用了 SELinux? 请参阅 http://archimedeseureka.blogspot.com/2011/01/executing-java-from-php-in-rhelcentos.html - 我在 Fedora 18 系统上遇到了这个问题,设置httpd_execmem似乎已经修复了它。