title: How to communicate with java code in PHP
body: <p>G' Day,</p>
  
  <p>I have a requirement, where need to invoke java function in PHP script. I have been gone through PHP JAVA Bridge concept but not able to call from PHP script. May be my Process was wrong. Please find the below process what i have been implemented. </p>
  
  <ol>
  <li><em><strong>step -1</em></strong> 
   C:\xampp\htdocs\tomcat\webapp Need to pest JavaBridge.war
  in this webapp.</li>
  <li><p><em><strong>step - 2</em></strong> 
   Extract this (JavaBridge.war) file. then go to
  JavaBridge/WEB-INF/lib/ and copy below three files and pest into 
  C:\xampp\htdocs\tomcat\webapp\bin</p>
  
  <p>php-script.jar php-servlet.jar servlet_api.jar</p></li>
  <li><p><em><strong>Step -3</em></strong>
  Edit the Tomcat conf/web.xml. Add the following 9 lines
  marked with a +:</p>
  
  <p></p>
  
  <pre><code>    + &lt;listener&gt;&lt;listener-class&gt;php.java.servlet.ContextLoaderListener&lt;/listener-class&gt;&lt;/listener&gt;
      + &lt;servlet&gt;&lt;servlet-name&gt;PhpJavaServlet&lt;/servlet-name&gt;&lt;servlet-class&gt;php.java.servlet.PhpJavaServlet&lt;/servlet-class&gt;
      + &lt;/servlet&gt;
      + &lt;servlet&gt;&lt;servlet-name&gt;PhpCGIServlet&lt;/servlet-name&gt;&lt;servlet-class&gt;php.java.servlet.fastcgi.FastCGIServlet&lt;/servlet-class&gt;
      + &lt;init-param&gt;&lt;param-name&gt;prefer_system_php_exec&lt;/param-name&gt;&lt;param-value&gt;On&lt;/param-value&gt;&lt;/init-param&gt;
      + &lt;init-param&gt;&lt;param-name&gt;php_include_java&lt;/param-name&gt;&lt;param-value&gt;Off&lt;/param-value&gt;&lt;/init-param&gt;
      + &lt;/servlet&gt;
      + &lt;servlet-mapping&gt;&lt;servlet-name&gt;PhpJavaServlet&lt;/servlet-name&gt;&lt;url-pattern&gt;*.phpjavabridge&lt;/url-pattern&gt;
  </code></pre>
  
  <p>
          + PhpCGIServlet*.php
          ...<br>
          </p></li>
  <li><p>step - 4
  Start Tomcat again. Now you can add PHP scripts to tomcat.</p></li>
  <li><p>step - 5 Add a PHP test file</p>
  
  <pre><code>&lt;?php require_once("java/Java.inc");
  echo java("java.lang.System")-&gt;getProperties(); ?&gt; 
  </code></pre>
  
  <p>to some web context, for example "examples", and browse to
  <a href="http://yourHost.com:8080/examples/test.php" rel="nofollow">http://yourHost.com:8080/examples/test.php</a>.</p></li>
  </ol>
  
  <p><em><strong>Its working fine but when i am run this file in htdocs (<a href="http://yourHost.com/test.php" rel="nofollow">http://yourHost.com/test.php</a>) its throwing exceptions.</em></strong> </p>
  
  <p>Please suggest me if i have been implemented wrong process or let me know if any new interface will work through this problem. </p>
  
  <p>I do appreciate for Adv help. </p>