I want to run -jar file from my php script, my -jar file run perfectly through commandline but i want to integrate it to my website but it is not working properly and also not provide me any error. my code is below
if (isset($_POST['Export'])) {
exec('java -Xmx1024M -jar C:\UploadTest-1_2.jar http://localhost:8080/packaging/Package C:\book\testbook.pdf –pass park345');
echo 'export button clicked';
}
output is:
export button clicked but -jar not doing needful.
javacommand? Does it have permission to access the.jarfile? Does it have permission to do everything else it needs to do to execute this statement? Also, Ron made a good point. Can the PHP process even find thejavacommand? As a matter of practice, you should fully-qualify the command here. If a malicious user created an executable calledjavain another path then your PHP script could potentially run a different executable.