I think i know the answer..
The solution : call program java -version.
This assume that i not install php-java extension.
If the JRE is exists, then it will print the java version.
Otherwise, it will output program not found.
Array
(
[0] => java version "1.6.0_03"
[1] => Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
[2] => Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
)
Why we can not just write it "java -version"?
Because :
Originally Posted by Rob Prime on [url
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=021218][/url]
java -version writes to the error stream, not the output stream.
the only problem is that this approach is dependent on having the java executable on the path of the user executing your PHP script. right now you're running on ubuntu so more likely than not, PHP is running as you. however, in production servers PHP will likely be executed as 'nobody' meaning java has to be on nobody's path.
the only problem is that this approach is dependent on having the java executable on the path of the user executing your PHP script. right now you're running on ubuntu so more likely than not, PHP is running as you. however, in production servers PHP will likely be executed as 'nobody' meaning java has to be on nobody's path.
Aaa....
You are right!! Absolutely right!!
So then, it down again..
You have better approach or technique??
Please help, and thanks for your precious information...
Bookmarks