Php and java Bridge-javabridge2008-03-0517: 26 due to project needs, must use php to call java, tried two ways to bridge (local test, windows) :. use the php module php_java.dll1. configure php. remove the INI file; ext php and java Bridge -- javabridge
Due to project needs, you must use php to call java, tried two ways of bridging (local test, windows) one :. use the php module php_java.dll1. configure php. remove the INI file; semicolon [java] java before extension = php_java.dll. library = E: \ project \ eclipse \ jre \ bin \ client \ jvm. dlljava. home = E: \ project \ eclipse \ jre \ java. library. path = E: \ project \ xampp \ php \ ext \ java. class. path = E: \ project \ xampp \ php \ ext \ php_java.jar where java. library is the path of the java virtual machine, java. home is the java path, java. library. path is the extension path of php, java. class. path is the path of php_java.jar 2. restart apache3. test code try {$ system = new Java ('Java. lang. system '); // demonstrate property access echo 'Java version = '. $ system-> getProperty ('Java. version ').'
'; Echo 'Java vendor ='. $ system-> getProperty ('Java. upload ').'
'; Echo' OS = '. $ system-> getProperty ('OS. name '). ''. $ system-> getProperty ('OS. version '). 'on '. $ system-> getProperty ('OS. arch ').'
';} Catch (JavaException $ e) {echo $ e-> getCause ();} test result: Java version = 1.5.0 _ 09 Java vendor = Sun Microsystems Inc. OS = Windows XP 5.1 on x86 note: apache died during the php5 test and php4 could run. the specific cause was not found. it is estimated that it could not be loaded to Java Virtual Machine 2: Download php-java-bridge_5.2.0_j2ee.zip with JavaBridge. war, available winrar decompress in JavaBridge \ WEB-INF \ lib has a JavaBridge. jar file. use the command line to call java-jar JavaBridge. jar or double-click JavaBridge. jar, select listening port 2 in the pop-up window. copy the entire java folder in JavaBridge to the PHP file directory. test require_once ("java/java. inc "); try {$ system = new Java ('Java. lang. system '); // demonstrate property access echo 'Java version = '. $ system-> getProperty ('Java. version ').'
'; Echo 'Java vendor ='. $ system-> getProperty ('Java. upload ').'
'; Echo' OS = '. $ system-> getProperty ('OS. name '). ''. $ system-> getProperty ('OS. version '). 'on '. $ system-> getProperty ('OS. arch ').'
';} Catch (JavaException $ e) {echo $ e-> getCause ();} test result: Java version = 1.5.0 _ 09 Java vendor = Sun Microsystems Inc. OS = Windows XP 5.1 on x86, the basic php and java bridging is basically completed.