Anyway, the mystification of Zend Java Bridge attracts me to give it a shot. Here are simple steps about how to install and configure Zend Java Bridge.
1) Following post Installing Zend server CE on Fedora 14 and fix YUM update to install Zend Server CE on Fedora 14.
2) Running command
yum search java-bridge to have output similar as below.
[root@jiaFedora14 yyjia]# yum search java-bridge
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
updates/pkgtags | 56 kB 00:00
======================================================================== Matched: java-bridge =========================================================================
php-5.2-java-bridge-zend-server.x86_64 : Zend Java bridge
php-5.3-java-bridge-zend-server.x86_64 : Zend Java bridge
[root@jiaFedora14 yyjia]#
3) call command
yum install php-5.3-java-bridge-zend-server to install Zend Java Bridge as I installed php 5.3 version on my machine. 4) call command
/usr/local/zend/etc/rc.d/06jb stop and command /usr/local/zend/etc/rc.d/06jb start to start Zend Java Bridge if it is necessary. Or you can enable/disable Zend Java Bridge from Zend Server admin Web page. 5) compile following Java code into a .jar file, say jia.jar and add put it into directory
/usr/local/zend/bin. SystemPropertyList.java
package jia.blog.util.lang;
import java.util.Properties;
/**
*
* @author Yiyu Jia
*/
public class SystemPropertyList {
public static Properties listSystemProperties(){
return System.getProperties();
}
}
6) open file
/usr/local/zend/etc/watchdog-jb.ini and add jia.jar file into the CLASSPATH.7) put below PHP code into directory, where Zend server executes php file. For example,
/var/www/html. javaInfo.php
<?php
$javaEnv = new Java("jia.blog.util.lang.SystemPropertyList");
$out = $javaEnv->listSystemProperties();
?>
List of JVM System Properties
| <?php echo $key; ?> | <?php echo $value; ?> |
8) open web browser and access php code, for example
http://localhost/javaEnv.php. If you can see the list of Java system properties, it is done. Enjoy it. This Java system properties is very important for Java programmer to create java app running in Zend Java Bridge.Note: it seems that Zend Java Bridge does not support Java class hot deployment. So, you may need to restart Java Bridge every time after you modified your java classes.