How can I embed a java programme in PHP file and what
changes have to be done in PHP.ini file?



How can I embed a java programme in PHP file and what changes have to be done in PHP.ini file?..

Answer / pankajbisane

There are two possible ways to bridge PHP and Java: you can
either integrate PHP into a Java Servlet environment, which
is the more stable and efficient solution, or integrate Java
support into PHP. The former is provided by a 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.

Example Code:

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')); ?>

The behaviour of these functions is affected by settings in
php.ini.
Table 1. Java configuration options
Name
Default
Changeable
java.class.path
NULL
PHP_INI_ALL
Name Default Changeable
java.home
NULL
PHP_INI_ALL
java.library.path
NULL
PHP_INI_ALL
java.library
JAVALIB
PHP_INI_ALL

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More PHP Interview Questions

What is php used for?

0 Answers  


What is helper library?

0 Answers  


When to use self over $this?

0 Answers  


Hi all, I have a problem in Apache on windows xp.I tried to unistall apache and install it again. But when in did the installation again, and tried to run apache, i get the following error message, Socketaddresse can just be used once. Make_sock: could not build to address 0.0.0.0.80 No listening sockets available.Shutting down Unable to open logs. and i also get (error) OS2. The system cannot fine the installed service named "Apache2". Please i need some one to help me out with this.I'm really fustrated cuz i need this stuff working as fast as possible. PLEASE HELP ME

2 Answers  


Why use php artisan serve?

0 Answers  






Which is variable cost?

0 Answers  


What does echo mean in php?

0 Answers  


What is session php?

0 Answers  


What is scope of variable in php?

0 Answers  


Write the code for upload a video file in PHP.How will You Play this in Your Page.?

2 Answers   ASD Lab, Convex Digital,


Does php pass arrays by reference?

0 Answers  


How to restrict the number of users login ? For ex:- if the allowed login is 10, for 11th user, the application should restrict them from login.

1 Answers  


Categories