home client api server api protocol f.a.q. downloads

How to use the PHP/Java Bridge in Eclipse.

This guide shows how to develop PHP/Java applications using an eclipse-based PHP IDE.

Install Eclipse and the PHP/Java Bridge library

  • Download and install an eclipse-based PHP IDE, for example Zend Studio.
  • Create a PHP project and drag and drop Java.inc and JavaBridge.jar to your eclipse PHP project using a file manager.

Test your eclipse project

  1. Create a PHP test script. For example:
    <?php
    define("JAVA_SERVLET", false); define("JAVA_HOSTS", 9267); require_once("Java.inc");

    echo new java("java.lang.String", "hello world");
    echo     java("java.lang.System")->getProperties();
    ?>

  2. Run your test script. Click on the run button and wait up to 30 seconds for the first result to appear.
  3. Your PHP script has started a Java server in the background and called the Java procedure "java.lang.System.getProperties()".
  4. Develop your PHP/Java application. Use the procedure echo java_inspect($jval) to inspect a Java class from PHP. Either use the procedure java_require("app.jar;lib1.jar;libn.jar") to load Java applications and their libraries dynamically or change the JAVA_SERVLET and JAVA_HOSTS to use a Java application back end.
For further information please see the PHP/Java Bridge API documentation.