can i call Java method.That is java code from php,here what i m
looking for i have class called DB in this class all the DB related
things ,like DB connection DB insert,DB read etc Methods are defined.
"All i m looking for just call the DB method from PHP that Read
data from DB".
here i m using phptriad2-2-1 that has support for java
i made changes to "php.ini" file i have added the following lines to
this file
[change]
java.class.path = .\php_java.dll
java.home = C:\Program Files\Java\jdk1.5.0_11
java.library = C:\Program Files\Java\jre1.5.0_11\bin\client\jvm.dll
java.library.path = C:\apache\php\extensions\
[/change]
her i don't have php_java.jar so i musing php_java.dll
and here is the follwing simple code.
Expand|Select|Wrap|Line Numbers
- <HTML>
- <HEAD>
- <TITLE>Test for Java</TITLE>
- </HEAD>
- <BODY>
- <?php
- // get instance of Java class java.lang.System in PHP
- $system = new Java('java.lang.System'); //here is the error
- // 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'));
- ?>
- </BODY>
- </HTML>
but it gives the following error in browser
[error]
Fatal error: Cannot instantiate non-existent class: java in c:\apache
\htdocs\web\phpjava.php on line 8
[/error]
some body help.
Thanks
VM