Class ScriptRunner<T>

  • Type Parameters:
    T - The evaluation response type.

    public class ScriptRunner<T>
    extends Object

    Runs scripts written in a programming language supported by the provided script engine. Java SE 6 and higher includes the JSR 223 API, which allows to "plug" any script engines to support your favorite scripting language.

    JavaScript

    The JavaScript (ECMAScript) script engine should already be present as part of your Java installation and is the default script engine used by this class when none is specified. As of Java 8, the Oracle version of Java uses the Nashorn engine, an implementation of the ECMAScript Edition 5.1 language specification (greater version of Java may use a more recent edition). Prior to version 8, Java used a JavaScript engine based on Mozilla Rhino.

    Lua

    As of 2.7.0, support for the Lua script engine is available. It relies on the LuaJ project to do so. To use it, set "lua" as the scripting engine with setEngineName(String).

    Others

    Several third-party script engines already exist to support additional languages such as Groovy, JRuby, Scala, Fantom, Jython, etc. Refer to appropriate third-party documentation about these languages to find out how to use them.

    Note: While using a scripting language can be very convenient, it requires extra knowledge and should only be considered by experimented or adventurous users. Use at your own risk.

    Since:
    2.4.0
    Author:
    Pascal Essiembre
    See Also:
    ScriptFilter, ScriptTagger, ScriptTransformer