Hey guys,
Here's my problem: I have a java jar file that is working correctly and all, but when the file is run, it asks the user for some input, then based on that input, does some calculations and prints out the results using System.out.print to the screen.
What I would like is to call the jar file from a php script, but I don't know how to pass the values to the jar file for it to do the calculations? Any ideas? Here's how I am calling the jar file from php:
<?php
$output = array(); //array to store output
$return_var = 0;
exec('java -jar className.jar', $output, $return_var); //actual call to jar file
$output_str = join($output,"\n");
echo $output_str."\n".$return_var; //supposed to output data, but since no input was //given, no data is returned
?>
Whenever I call this as it is, it just returns a 1, I guess meaning it got called successfully? but without input? Thanks for any help.