Problem with PHP using Java Classes

From: Date: Tue, 02 Jan 2001 21:44:53 +0000
Subject: Problem with PHP using Java Classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32364@lists.php.net to get a copy of this message
Ok. I am using the latest version of PHP (4.04) on a linux box with apache 3.0.12. I have compiled it using --with-mysql --with-apxs --with-java as a DSO. I have modified my php.ini file (in /usr/local/lib) and added in the following: [Java] ;java.class.path = .\php_java.jar ;java.home = c:\jdk ;java.library = c:\jdk\jre\bin\hotspot\jvm.dll ;java.library.path = .\ java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214 ;java.class.path=/usr/local/lib/php_java.jar:/usr/local/java/j2sdkee1.2.1/lib/j2ee.jar:/usr/local/java/jsdk2.0/jsdk.jar:/home/verity/k2220/Java/vsearch.jar ;java.class.path=/usr/local/lib/php_java.jar:/home/verity/k2220/Java/vsearch.jar java.class.path=/usr/local/lib/php_java.jar:/usr/local/lib/php/extensions/no-debug-zts-20001214:/opt/jdk1.2.2/jre/lib/i386:/opt/jdk1.2.2/jre/lib/i386/classic:/opt/jdk1.2.2/jre/lib/i386/native_threads:/home/verity/k2220/Java/vsearch.jar:/home/rondaks_portal/httpd/docs/k2test ;extension_dir=/usr/local/lib:/home/local/java/jdk1.2.2/jre/lib/i386:/jdk1.2.2/lib/i386 extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386 extension=libphp_java.so Now, when I put the following in my .php file: <? /* ** Adapted from Sam Ruby's example */ //get version of Java $system = new Java("java.lang.System"); print("Java version: " . $system->getProperty("java.version") . "<BR>\n"); // // print formatted date $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"); ?> or: <? // Now do a little example calling the Results class printf("<pre>\n"); $result = new Java("Results"); printf("</pre>\n"); ?> I get the following error message: <b>Fatal error</b>: Cannot instantiate non-existent class: java in <b>/home/rondaks_portal/httpd/docs/k2test/index.php3</b> on line <b>31</b><br> I know that the Results class runs and so should the first example. Note: the line that I get the fatal error on is always the frist call of new Java() and then the PHP aborts (obviously). Has anyone been able to get around this? I would appreciate any help that you folks could give. Thanks. Sincerely, Fraser MacKenzie

« previous php.general (#32364) next »