Hi there,
I have been trying to set up the Java-PHP bridge all day. I have had some success, as some examples work. However, others just spit out an error along the lines of Java class cannot be found.
For example, this works fine:
PHP Code:
<%
out.println ("hello from the servlet <br>");
javax.script.ScriptEngine e =
php.java.script.EngineFactory.getPhpScriptEngine (this,
application,
request,
response);
e.getContext().setWriter (out);
e.eval (
"<?php "+
"require_once ($_SERVER['DOCUMENT_ROOT'].'/java/Java.inc');" +
"$ctx = java_context();" +
"echo 'hello from PHP '.$ctx.'<br>\n'"+
"?>"
);
%>
Does that mean I've set it up successfully?
I guess in-order to answer that you need to know what I've done
Downloaded and installed JDK 1.6.0_07
Downloaded and installed Apache TomCat 6.0.16
Started Apache Tomcat
Downloaded PHP-Java Bridge 5.2.2
Then followed this instruction from
http://php-java-bridge.sourceforge.net/doc/faq.php:
Just copy JavaBridge.war to the Tomcat (or J2EE-) webapps directory, wait a second until the directory JavaBridge/ appears, then copy the JavaBridge directory over to your Apache or IIS document root.
Unfortunately, I need help with the last part.......copying the JavaBridge Directory over to the Apache root folder. Which version of apache do I need. I installed the HTTP 2.2 server, but I am clueless of how to set it up. Also why is that last step needed?
I am just trying to test all this locally on my PC for the moment.
Do I need to install J2EE? I just feel like i've missed something out here.
I read guides on hiveminds.co.uk:
here:
http://www.hiveminds.co.uk/content/h...solutions.html
and here:
http://www.hiveminds.co.uk/content/h...he-tomcat.html
They confused me though. I've tried both ways and the only thing that works is how I installed the software as decsribed above.
Can anyone give me a comprehensive guide on how to do this properly?? The others are quite hard to follow, and when you get errors they don't explain how to get around them.
I would like to be able to create a java script, compile it and then use PHP to grab it and show the results. Something just as simple as hello world! Not asking for much lol.
any help would be cool.
rgds
Jp