I'm trying to use the bridge to in order to use htmlunit from php code. I
want to use it as standalone not as a webapp.
I have the JavaBridge.jar file in a directory and I have all of the htmlunit
jars and support jars in the same directory.
I can run the server using:
java -Djava.awt.headless="true" -verbose -jar JavaBridge.jar
SERVLET_LOCAL:8080
and can then access it via localhost:8080 from Firefox. So it seems to be
working.
However when I try to run my test program:
-------------------------
<?php
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
$javaSystem = Java("java.lang.System");
$i1 = new Java("java.math.BigInteger", "1");
$i2 = new Java("java.math.BigInteger", "2");
$i3 = $i1->add($i2);
echo $i3->toString() . "\n";
$wc = new Java('com.gargoylesoftware.htmlunit.WebClient');
?>
--------------------------
The java system instance is created OK and the math works and writes "3" out
- but the new of 'com.gargoylesoftware.htmlunit.WebClient' throws a class
not found exception. So I think maybe the server isn't seeing the
htmlunit-2.7.jar file.
I have added the code to the above program that shows the classpath property
and it shows only "JavaBridge.jar" - and I can't figure out how to set it
correctly and what to set it to.
I've spent many hours trying to figure this out and really appreciate any
help you can give.
Rick
|