在Web服务器上使用php脚本执行java文件

when I execute a java file using php command

exec('java test2');

it runs perfectly, while when I do the same thing on the web-server, it does nothing I am unable to find the reason, can anybody please tell me the possible reason, thanks in advance

  • Do you have Java installed in your web server?
  • Is it added to your PATH?
  • Does your webserver user have execution permissions on it?
  • Do you have enough memory available as to start a JVM?

There are so many reasons why this could fail. Try logging into your server via ssh and execute 'java -version'.

Make sure you specify

-Djava.awt.hedless=true

in your java command