Hi Richard,

I have finally got Java working with PHP. My Java is JSDK 1.4.0, the latest
release of the SDK from Sun. How do I know it's working? I put

        $system = new Java("java.lang.System");

        print "Java version=".$system->getProperty("java.version")."
<br>\n";
        print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
        print "OS=".$system->getProperty("os.name")." ".
              $system->getProperty("os.version")." on ".
              $system->getProperty("os.arch")." <br>\n";

        $formatter = new Java("java.text.SimpleDateFormat","EEEE,
                        MMMM dd, yyyy 'at' h:mm:ss a zzzz");
        print $formatter->format(new Java("java.util.Date"))."<br>\n\n<br>";

into my PHP script and get:

        Java version=1.4.0
        Java vendor=Sun Microsystems Inc.
        OS=Linux 2.4.2-2 on i386
        Thursday, February 28, 2002 at 12:44:03 PM GMT-05:00

Nice, huh? Now, next step is to test BrowserHawk. I do not have servlet
support on my Apache webserver, but according to the BrowserHawk README
file, and I quote

BrowserHawk4J can be used anywhere server-side Java(tm) is available,
including servlets, JavaServer Pages, server-side JavaScript, and even
stand-alone Java applications. The only requirement is a Java Virtual
Machine version 1.1.x or higher. Note that to use any of the extended
properties of BrowserHawk4J (as defined below), you must use the BH4J
bean from a servlet or JSP environment.

So, I take this to mean that as long as I do not try to get extended
properties, I should be able to use my current setup to use BrowserHawks
basic capabilities. Fine, for the first step. My php.ini looks like

[Java]
java.class.path =
/usr/local/lib/php/php_java.jar:/usr/local/BrowserHawk/lib/bhawk4j.jar:/usr/
local/BrowserHawk
java.home = /usr/java/j2sdk1.4.0
java.library = libjava.so
java.library.path = /usr/local/lib/php/extensions/no-debug-non-zts-20010901
extension_dir = /usr/local/lib/php/extensions/no-debug-non-zts-20010901
extension = libphp_java.so


and my CLASSPATH and LD_LIBRARY_PATH are

[root@centauri /root]# echo $CLASSPATH
/usr/local/BrowserHawk/lib/bhawk4j.jar:/usr/local/BrowserHawk
[root@centauri /root]# echo $LD_LIBRARY_PATH
/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/server:/
usr/local/lib/php:/usr/local/BrowserHawk/lib


but, when I point my browser to
http://localhost/BrowserHawk/examples/showbrow-ssjs.html I get:

Browser Capabilities Test Page
The following is information on your web browser's capabilities
as detected by BrowserHawk4J using Netscape's Server-Side JavaScript
technology.

User agent: write(request.agent)

if (b == null) { Browser information was null. This should never happen. In
case of error, getBrowserInfo() throws a BrowserHawkException.

}

Has anyone else gotten BrowserHwk running under PHP using Java extension?
Any suggestions would be appreciated. As far as I can tell (as my java is
definitely working!) this should work.


Thanks,
Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to