Kedar
Kedar

Reputation: 1

.jar file not executing on server through php code

I am trying to execute .jar file on my windows server through php file. I have successfully executed file on localhost using exec and shell_exec commands but I am not able to execute it on server.

<?php
error_reporting(E_ALL);
$cmd = "";
$cmd = shell_exec("java -jar C:/--Path for file--/programs/addTwo_live.jar 3 5");
echo $cmd;
?>

This code should simply add two numbers (3 and 5) and store result in the database table.

I have found some related topics on stack overflow and done the following things suggested in some topics. 1. Given full permission to the files and folders. 2. Checked that exec is enabled

Also Current script owner and output of whoami are different After executing the php file I could not see an error message and nothing is inserted in to the database. Please help me

Upvotes: 0

Views: 347

Answers (1)

1) You probably dont have JRE or JDK installed. 2) Java might not be in your PATH.

Upvotes: 1

Related Questions