|
From: <php...@li...> - 2014-06-27 12:10:43
|
Hi everyone!!!!
I would like to ask how to call a java class from php.
After research on internet, I’ve following a tutorial who tells me to put my project in jar file and to put it on Tomcat/webapps/myproject/WEB-INF/lib. And then to call it on my php script with
<?php
require_once("java/Java.inc");
$obj = new Java('HelloWorld');
?>
But it doesn’t work.
I have followed the jee documentation with javabridge.zip too. I put my project in .war file and put the .jar into Tomcat/webapps then it deployed my project. After that, I create php file and put this script
<?php
define("JAVA_HOSTS", 127.0.0.1:8080);
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");
require_once("java/Java.inc");
echo java("java.lang.System")->getProperties();
?>
PS I’m working on Apache for php and Tomcat for java.
Both don’t work.
Need help , please.
Thanks.
Finoana
|