Java Functions


When Java support is available, a global Java class is defined, which is used to instantiate Java classes into PHP objects. These objects can then be used just as with normal PHP objects; methods of the Java class can be called using PHP syntax, and so on. Two functions are also defined to help the programmer deal with Java exceptions, for which PHP has no built-in support. java_last_exception_get() returns an object representing the last exception to have been thrown by a Java class, and java_last_exception_clear() allows the programmer to remove the last exception from memory.

Java support needs to be built into PHP using the --with-java=[DIR] configure option. It will always be built as a shared library, which will be installed along with the rest of PHP during the installation process.

Please read the README in the PHP source distribution in the file ext/java/README, as it contains important information on setting up PHP for use with Java.