Overview

Packages

  • None
  • pdb

Classes

  • Java
  • java_AbstractJava
  • java_ApplyArg
  • java_Arg
  • java_ArrayProxy
  • java_ArrayProxyFactory
  • java_CacheEntry
  • java_ChunkedSocketChannel
  • java_class
  • java_Client
  • java_CompositeArg
  • java_EmptyChannel
  • java_ExceptionProxy
  • java_ExceptionProxyFactory
  • java_GlobalRef
  • java_HttpTunnelHandler
  • java_InternalJava
  • java_IteratorProxy
  • java_IteratorProxyFactory
  • java_JavaProxy
  • java_JavaProxyProxy
  • java_NativeParser
  • java_objectIterator
  • java_Parser
  • java_ParserString
  • java_ParserTag
  • java_Protocol
  • java_ProxyFactory
  • java_SimpleFactory
  • java_SimpleHttpHandler
  • java_SimpleHttpTunnelHandler
  • java_SimpleParser
  • java_SocketChannel
  • java_SocketChannelP
  • java_SocketHandler
  • java_ThrowExceptionProxyFactory
  • JavaClass

Interfaces

  • java_JavaType

Exceptions

  • java_ConnectException
  • java_exception
  • java_IllegalArgumentException
  • java_IllegalStateException
  • java_InternalException
  • java_IOException
  • java_JavaException
  • java_RuntimeException
  • JavaException

Functions

  • __javaproxy_Client_getClient
  • Java
  • java_autoload
  • java_autoload_function
  • java_autoload_function5
  • java_begin_document
  • java_call_with_continuation
  • java_cast
  • java_cast_internal
  • java_checkCliSapi
  • java_closure
  • java_closure_array
  • java_context
  • java_defineHostFromInitialQuery
  • java_end_document
  • java_eval
  • java_get_base
  • java_get_closure
  • java_get_context
  • java_get_lifetime
  • java_get_server_name
  • java_get_session
  • java_get_values
  • java_getCompatibilityOption
  • java_getHeader
  • java_inspect
  • java_inspect_internal
  • java_instanceof
  • java_instanceof_internal
  • java_invoke
  • java_is_false
  • java_is_null
  • java_is_true
  • java_isfalse
  • java_isnull
  • java_istrue
  • java_last_exception_clear
  • java_last_exception_get
  • java_require
  • java_reset
  • java_server_name
  • java_session
  • java_session_array
  • java_set_encoding
  • java_set_file_encoding
  • java_shutdown
  • java_truncate
  • java_unwrap
  • java_values
  • java_values_internal
  • java_virtual
  • java_wrap
  • Overview
  • Package
  • Function
  • Todo
  • Deprecated

Function java_last_exception_get

Return the last stored Java exception.

The last stored Java exception is the first undeclared java.lang.RuntimeException or java.lang.Error after the last java_last_exception_clear() invocation or, if no RuntimeException/Error occured, the last declared exception reported via the script engine's try/catch mechanism.

Useful for script engines which do not support try/catch or if you want to handle java.lang.RuntimeException or java.lang.Error in your PHP code.
Note the distinction between java.lang.Exception, which can be caught on PHP level, and java.lang.RuntimeException/java.lang.Error, which raise a fatal PHP error at the end of the php script (unless the error condition is cleared using java_last_exception_clear()).
java.lang.Exception is a typical exception in your business logic, java.lang.RuntimeException is an exception caused by a bug in your program, for example java.lang.NullPointerException. java.lang.Error marks a serious problem, for example java.lang.OutOfMemoryError.

Example:

define ("JAVA_PREFER_VALUES", false);
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
try {
new java("java.lang.String", null); // raises java.lang.RuntimeException
assert (is_null(java_last_exception_get());
} catch (JavaException $e) {
echo $e;
}
License: GPL
Author: Jost Boekemeier
See: java_last_exception_clear()
See: JAVA_PREFER_VALUES
Located at JavaProxy.inc
Return value summary
mixed The last stored Java exception or null
VM Bridge API documentation generated by ApiGen