Causes the immediate execution of the script whose source is the String
passed as the first argument. The script may be reparsed or recompiled before
execution. State left in the engine from previous executions, including
variable values and compiled procedures may be visible during this execution.
Returns:
The value returned from the execution of the script.
Parameters:
-
script - The script to be executed by the script engine.
-
context - A
ScriptContext
exposing sets of attributes in
different scopes. The meanings of the scopes
ScriptContext.GLOBAL_SCOPE
,
and
ScriptContext.ENGINE_SCOPE
are defined in the specification.
The
ENGINE_SCOPE
Bindings
of the
ScriptContext
contains the
bindings of scripting variables to application objects to be used during this
script execution.
Throws:
-
ScriptException - if an error occurrs in script. ScriptEngines should create and throw
ScriptException
wrappers for checked Exceptions thrown by underlying scripting
implementations.
-
NullPointerException - if either argument is null.