After reading some of the posts in this website related to exactly the same issue I\'ve got, I found that none of them were giving me a successful result:
How to run a j
You have to do something like this:
//REPLACE THIS PATH WITH THE REAL JAVA PATH
$handle = popen(`"C:\\Program Files (x86)\\Java\\jre7\\bin\\java.exe arguments"`, "r"));
//You can read with $read = fread($handle, 2096)
pclose($handle);
exec will not work on Windows (for "external" executables) and in most cases you'll have to provide the full path to Java.
You can check with shell_exec, system() and other function pctl function as well. These functions might be disabled, so before executing check them or you can use this as well
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
More detail found here.
This is not a straight answer, but if calling java from Php does not work under any circumstances, you can also run jar files from Python scripts. I mean Php --> Python --> jar.
Calling Python scripts from Php always works for me.
This post helped me in the past:
Python: How can I execute a jar file through a python script