PDA

View Full Version : Gọi Java trong PHP



bighead
30-11-2006, 10:03
Giúp em với các pác ơi !

Sau khi cấu hình trong php.ini như sau:
extension=php_java.dll

[java]
; This must point to the location of php_java.dll.
java.library.path = "C:\php;"

; 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:\php\php_java.jar;E:\Myclasses"

; This points to the bin directory of the JDK.
java.home = "C:\Program Files\Java\jdk1.6.0\bin"

; This must point to the Java Virtual Machine (jvm.dll) file.
java.library = "C:\Program Files\Java\jre1.6.0\bin\client\jvm.dll"

Sau đó em viết trang PHP:

<?php
$systemInfo = new Java("java.lang.System");
print "Total seconds since January 1, 1970:
".$systemInfo->currentTimeMillis();
?>

nhưng khi chạy chương trinh thì bị báo lỗi:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Cứu với!!!!!!!!!!!!!!!!!!!!!

jiSh@n
30-11-2006, 10:18
Cái ext php_java.dll nằm trong thư mục C:\PHP hat C:\PHP\ext? Mà bạn nên cài Zend Platform, có cái Java Bridge tốt hơn cái ext này, có thể gọi được EJB.