Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-29-2008, 04:16 PM   PM User | #1
jpmad4it
New Coder

 
Join Date: Jan 2006
Posts: 85
Thanks: 2
Thanked 0 Times in 0 Posts
jpmad4it is an unknown quantity at this point
Setting up the Java-PHP bridge.....OMG please help!

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

Last edited by jpmad4it; 07-29-2008 at 04:19 PM..
jpmad4it is offline   Reply With Quote
Old 08-03-2008, 06:30 PM   PM User | #2
dimis283
New to the CF scene

 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dimis283 is an unknown quantity at this point
You may use this
dimis283 is offline   Reply With Quote
Old 08-05-2008, 11:09 AM   PM User | #3
jpmad4it
New Coder

 
Join Date: Jan 2006
Posts: 85
Thanks: 2
Thanked 0 Times in 0 Posts
jpmad4it is an unknown quantity at this point
Cool thank you, I will look into this.
jpmad4it is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:43 PM.


Advertisement
Log in to turn off these ads.