|
From: <php...@li...> - 2007-04-30 17:07:57
|
Hi,
> Hrm, this is frustrating. I put this together and
> received a "Call to
> undefined function java()" error (see full error
> below):
It is defined in Java.inc as:
function java($clazz) {
static $cache;
if(isset($cache)) return $cache;
return $cache=new JavaClass($clazz);
}
The function is handy because it hides the class
variable inside the function.
The code:
$System = new JavaClass("java.lang.System");
$systemProps = $System->getProperties();
is equivalent to:
$systemProps=java("java.lang.System")->getProperties();
but the latter is easier to read.
> It seems to not find the objects within Java.inc,
Hmm, when you use the java.so or php_java.dll, some
old versions of Java.inc don't define this function.
It may make sense to implement the function directly
in java.c.
> however it's including
> the file properly in the script so therefore I am
> considering that I
> don't have the Bridge installed properly.
Mea culpa. I thought that you use the pure PHP
implementation. Just remove the java.so and the script
will work.
> I've followed the j2ee instructions to install the
> bridge as I want
> Tomcat to run the JVM rather than a new JVM trying
> to run each request.
Correct.
> Is this incorrect? Does a JVM have to start every
> time anyway?
Well, you have two options, a) start Java as a sub
process of Apache or IIS (not recommended, needs
java.so) or b) start Java via a J2EE server or servlet
engine as a system service (recommended).
On Windows/Unix you can start tomcat as a service.
> running this on a Virtual Dedicated Hosting account
> and therefore it's
> not my own server to run as I please.
Hmm. Do you get a notification when the computer
boots? You can start a persistent java VM with
nohup java -jar JavaBridge.jar <port> 3 jb.log&
but the above VM will terminate when the computer
reboots.
> When I try to run this on the command line:
> java -jar JavaBridge.war --help
In which documentation have you found the above
command? The .war file is a web archive, not an
executable jar file. We could change that in the
future, though.
> I've saved java.so to the php-extension directory
-------
nak, nak, nak. Remove it, please. :)
The java.so contains code which could make the
communication faster. But it is quite difficult to
handle, especially for beginners.
Regards,
Jost Boekemeier
__________________________________ Yahoo! Clever - Der einfachste Weg, Fragen zu stellen und Wissenswertes mit Anderen zu teilen. www.yahoo.de/clever
|