Reputation: 53
I'm trying to execute a jar in PhP with this line
shell_exec("java -jar OCR.jar 2.jpeg /opt/lampp/htdocs/output/");
In the terminal this jar works well but in php not.
How fix this ?
Upvotes: 0
Views: 143
Reputation: 500
try calling
which java
in ubuntu console, this will probably give you
/usr/bin/java
so use the full path
also I suggest calling exec($command, $output) and print the output array to get more info. to redirect stderr stream to stdout end your command with 2>&1 , e.g.
/usr/bin/java -jar OCR.jar 2.jpeg /opt/lampp/htdocs/output/ 2>&1
Upvotes: 1