开发者

How to integrate PHP and JAVA?

I need an urgent help from you people.I got something very odd while trying to integrate php with java. First, my system specifications:

Windows XP

I have installed

XAMPP server:- xampp-win32-1.6.1-installer

This install PHP, Apache, and MySQL on my system. There versions are as follows

Apache Version :- Apache/2.2.4 (Win32)

PHP version :- 4.3.1

Sun Microsystems JDK version :- jdk1.6.0_16

I am achieving this PHP-JAVA extensoion using php-javabridge. I have downloaded javabridge.jar file from following url.

placed the downloaded javabridge.jar file on this path C:\xampp\php\ext\

Settings done in php.ini file for php-java integration are as follows.

; Directory in which the loadable extensions (modules) reside. extension_dir = "C:\xampp\php\ext\"

I also uncomment the java extension.

extension=php_java.dll

I have added following lines in Module Settings section of PHP.ini file.

;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;;

[Java] ;This points to the directory where your Java ;classes will be stored. You can designate multiple ;paths, each path separated by a semicolon. ;It must also include the location of php_java.jar java.class.path = "C:\xampp\php\ext\JavaBridge.jar;C:\xampp\php\extensions\php_java.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib;C:\Program Files\Java\jdk1.6.0_16;C:\prog"

;java.class.path = "C:\xampp\php\extensions\php_java.jar;C:\prog" ; This points to the bin directory of the JDK. java.home = "C:\Program Files\Java\jdk1.6.0_16\bin"

; This must point to the Java Virtual Machine (jvm.dll) file. java.library = "C:\Program Files\Java\jdk1.6.0_16\jre\bin\se开发者_如何学编程rver\jvm.dll"

; This must point to the location of php_java.dll. java.library.path = "C:\xampp\php\ext;C:\Program Files\Java\jdk1.6.0_16\jre\lib"

java.java = "C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

When I start the apache server service, the program runs ok. But, if I close the browser and open it again, the program no longer runs and give me a "Fatal error: Unable to create Java Virtual Machine in C:\php\java.php ...". If I restart the apache server service, the program works again, but with the same behavior: if I close the browser window and open it again, it does not work. I checked on internet but dont get any solution but found many people facing same problem. And many of them told its a bug in PHP-JAVA bridge. So is there any solution on this problem. I ran out of options and, if anyone could help, I'll appreciate. Thank You.


I tried the Php-JavaBridge recently, by downloading the latest version of Apache, Tomcat and using JDK8.0 and I think Php 5.4 and got it to work totally fine.

Perhaps try downloading the latest version of everything, start from scratch and install again, it may be you have some version mismatches.

I was using a Windows 64 bit computer, running Windows7.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜