title: How to run JAR file using php script?
body: <p>I tried JAVA bridge to get output from my jar file  followed this <a href="https://stackoverflow.com/a/10253798/1870048">https://stackoverflow.com/a/10253798/1870048</a>, I am using XAMP Server and from that Apache and Tomcat server is been used</p>
  
  <pre><code>  require_once("http://localhost:8080/JavaBridge/java/Java.inc");     
    $cartObj = Java("Cart"); //Javav("Cart");
    $cartObj-&gt;Cart("098765");
    $cartObj-&gt;setLang("EN");
    echo  $cartObj-&gt;getLang();
  </code></pre>
  
  <p>but gives error :
  Fatal error: Call to undefined function Javav() 
  What should I exactly I look into?</p>
  
  <p>Also I tried below way also to call the jar file by placing the jar file in my zampp htdoc folder: (D:\xampp\htdocs\jar) </p>
  
  <pre><code>//  Using shell_exec
  exec('java -jar AutoDiscounts.jar '.$jsonRequest.' 2&gt;&amp;1', $result);
  print_r($result);
  
  //  Using shell_exec
  $arg1 = $jsonRequest;//"My_INPUT_PARAMETER";
  $output = '';
  $output =shell_exec("java -jar AutoDiscounts.jar $arg1");
  echo "Done calling shell exec:";
  echo $output;
  </code></pre>
  
  <p>But both  above cases does not give any output .Basically my jar will do some cart processing and return output and it works in the JDevloper </p>
  
  <p><a href="https://i.stack.imgur.com/Q3zLH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q3zLH.png" alt="enter image description here"></a></p>