Wednesday, December 9, 2009

~~ How to Enable Java inside PHP OR Vice Versa ~~

I was wondering how we can interact PHP Within JAVA OR JAVA Within the PHP.
Here i find it easy way.
1. How to Call JAVA Inside the PHP.
**Change php.ini with enabling java options.
Example: getProperty('java.version') . ''; echo 'Java vendor=' . $system-getProperty('java.vendor') . ''; echo 'OS=' . $system->getProperty('os.name') . ' ' . $system-getProperty('os.version') . ' on ' . $system->getProperty('os.arch') . ' '; // 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')); ?>

2. How to Call PHP Inside the JAVA

SAPI module that interfaces with the Servlet server, the latter by this Java extension.
The Java extension provides a simple and effective means for creating and invoking methods on Java objects from PHP. The JVM is created using JNI, and everything runs in-process.

No comments: