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.
you saved my life! thanks!
ReplyDeleteHi Jia,
ReplyDeleteWhere should we keep the *.properties file for language translation (its for jasper report integration) ,Where to make bundle folder in java bridge corresponding to WEB-INF/Bundles in java
Interesting question. But, I am confused that you ask this question here. Wont you install your Jasper with application server like Tomcat?
ReplyDeletehi Jia
ReplyDeletethanks a lot for your tuto
but a have always the same problem
i try a lot of thinks but nothing work
error
No Class!*->jbridge('med.util.lang.S...')
any idea thanks
Where is med.util.lang.S from? I feel you need to double check the Step 5 and Step 6. Did you put your third party libraries under folder /usr/local/zend/bin ?
ReplyDeleteThank you for this invaluable information. I have a problem in trying Java Bridge: while I managed to install it perfectly fine locally, I cannot manage to have it running on an Openshift cloud. The problem is, I am not allowed to access packages in /var/lib/rpm. Openshift allows users to install packages ("cartridges") and I got Zend, but Java Bridge is not available by default. Do you know if it is possible to donwload the Zend Java Bridge package individually somewhere? My access restrictions on OpenShift are strange, e.g. I managed to install Jython from the .jar installer without any problem. Thank you!
ReplyDeleteI did not try to install them remotely. But, I would check the 06jb and chase all related jar files and configuration file.
DeleteAlso, did you try http://php-java-bridge.sourceforge.net/pjb/ ?