I’m using WAMP Server 2.0 on W7

First, edit your php.ini file and add the ff. lines

[java]
java.java_home = “C:\Program Files\Java\jre6\bin”
java.java = “C:\Program Files\Java\jre6\bin\java”
java.class.path = “C:\wamp\bin\php\php5.3.0\ext\JavaBridge.jar”
java.library = “C:\Program Files\Java\jre6\lib”
java.library.path = “C:\wamp\bin\php\php5.3.0\ext;C:\Program Files\Java\jre6\lib”

Just change the directory location according to your java and php installation folders.

also place the file “Java.inc” on your php include path.

you can download the Javan.inc and JavaBridge.jar at http://php-java-bridge.sourceforge.net/pjb/

Restart wamp services.

To test your java bridge capability just create and open this php file on your browser

test.php

<?php

try {

/* invoke java.lang.System.getProperties() */
$props = java(“java.lang.System”)->getProperties();

/* convert the result object into a PHP array */
$array = java_values($props);
foreach($array as $k=>$v) {
echo “$k=>$v”; echo “<br>\n”;
}
echo “<br>\n”;

/* create a PHP class which implements the Java toString() method */
class MyClass {
function toString() { return “hello PHP from Java!”; }
}

/* create a Java object from the PHP object */
$javaObject = java_closure(new MyClass());
echo “PHP says that Java says: “; echo $javaObject;  echo “<br>\n”;
echo “<br>\n”;

echo java(“php.java.bridge.Util”)->VERSION; echo “<br>\n”;

} catch (JavaException $ex) {
echo “An exception occured: “; echo $ex; echo “<br>\n”;
}

?>