title: How to execute a java -jar file using PHP, and load a file created by the .jar to the server?
body: <p>I am trying to execute a .jar file from a PHP script using the exec() command, more exactly using: </p>
  
  <pre><code>&lt;?php
  
      $command = 'java -jar myfile.jar';
  
      exec( $command, $output);
  
  ?&gt;
  </code></pre>
  
  <p>both the php script, and the jar are in the same directory on the server. The myfile.jar produces an excel spreadsheet, and I want this spreadsheet to be created or stored in the same directory or another directory for that matter on the server. When I execute myfile.jar in the terminal of my pc, the program works fine and outputs the file to the directory where the .jar is located.</p>
  
  <p>Any ideas?</p>
  
  <p>Best Regards.</p>