calling java within php setup?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to call java within php.  I have JAVA JRE 1.6 installed.  The php
I'm using is distributed by our partner so I couldn't configure it to use
JAVA.

I've modified the "php.ini" file to add the JRE path to it:

java.class.path="/usr/java/jre1.6.0_01"
java.home="/usr/java/jre1.6.0_01/bin"
java.library.path="/usr/java/jre1.6.0_01/lib"


I've wrote a Basic java within php, but I get error: "Fatal error: Class
'Java' not found.  What am I missing?  Can I import java in php?

Below is the java part:

 <?php
// get instance of Java class java.lang.System in PHP
$system = new Java('java.lang.System');

// demonstrate property access
echo 'Java version=' . $system->getProperty('java.version') . '<br />';
echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />';
echo 'OS=' . $system->getProperty('os.name') . ' ' .
             $system->getProperty('os.version') . ' on ' .
             $system->getProperty('os.arch') . ' <br />';

// java.util.Date example
$formatter = new Java('java.text.SimpleDateFormat',
                      "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");

echo $formatter->format(new Java('java.util.Date'));
?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux