|
From: <php...@li...> - 2008-03-10 13:20:12
|
Hi,
> public static void main(String[] args) {
> obj = new Integer(15);
> System.out.println(getObj());
> while(true);
> }
> public static int getObj() { return obj; }
> }
Okay. But you may want to use Thread.sleep() instead of the while(true); loop. :)
> I make a jar archive from it (phpjava.jar). The jar contains:
> Main-Class: app.Main
> Class-Path: JavaBridge.jar
Okay.
Next you can run a PHP script as follows:
<?php require("http://localhost8091/JavaBridge/java/Java.inc");
$myClass = new java("app.Main");
echo $myClass->getObj();
?>
> I put the archive into my deployment directory 'ext'. This directory
> contains:
> - java/Java.inc
> - hello.php
> - JavaBridge.jar
> - phpjava.jar
I don't understand why this is necessary.
> According to the manifest of JavaBridge.jar, I have also put in 'ext' (just
> in case):
> - php-script.jar
> - script-api.jar
No. These are the JSR223 bindings.
> Here is the php script:
> <?php
> require_once("java/Java.inc");
> java_require("phpjava.jar");
> $myClass = new java("app.Main");
> $obj = $myClass->getObj();
> echo $obj;
> ?>
No. The above script connects to the wrong application (if any). The java_require() is not
necessary either, your application already knows about app.Main.
> I launch the JavaBridge.jar by right-clicking on it and 'execute with
No. You have already started your application.
Regards,
Jost Boekemeier
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go
|