Java Utililty Methods Script Engine

List of utility methods to do Script Engine

Description

The list of methods to do Script Engine are organized into topic(s).

Method

CompiledScriptcompile(ScriptEngine engine, String script)
compile
if (engine instanceof Compilable) {
    Compilable compEngine = (Compilable) engine;
    return compEngine.compile(script);
return null;
ScriptEnginecreateNashornEngine()
create Nashorn Engine
return s_aScriptFactory.getEngineByName("nashorn");
ObjectevaluateScriptResource(ScriptEngine engine, String resource)
evaluate Script Resource
String script = getScriptResource(resource);
return engine.eval(script);
ScriptEnginegetAppleScriptEngine()
Obtiene el motor de script AppleScript.
final ScriptEngine se = new ScriptEngineManager().getEngineByName("AppleScriptEngine"); 
if (se != null) {
    return se;
return new ScriptEngineManager().getEngineByName("AppleScript"); 
List>getAvailableEngineGroups()
get Available Engine Groups
List<List<String>> availableNames = new Vector<List<String>>();
ScriptEngineManager manager = new ScriptEngineManager();
List<ScriptEngineFactory> factories = manager.getEngineFactories();
for (ScriptEngineFactory factory : factories) {
    availableNames.add(factory.getNames());
return availableNames;
ScriptEngineManagergetDefaultScriptEngineManager()
get Default Script Engine Manager
return DEFAULT_SCRIPT_ENGINE_MANAGER;
ScriptEnginegetEngine()
get Engine
return engine;
ScriptEnginegetEngine(String engineName)
get Engine
if (engineName != null) {
    ScriptEngineManager factory = new ScriptEngineManager();
    ScriptEngine engine = factory.getEngineByName(engineName);
    if (engine != null) {
        return engine;
    engine = factory.getEngineByExtension(engineName);
    if (engine != null) {
...
ScriptEnginegetScriptEngine()
get Script Engine
long id = Thread.currentThread().getId();
ScriptEngine engine = context.get(id);
if (engine == null) {
    ScriptEngineManager engineManager = new ScriptEngineManager();
    engine = engineManager.getEngineByName("nashorn");
    context.put(id, engine);
return engine;
...
ScriptEnginegetScriptEngine(final ClassLoader loader, final String... args)
get Script Engine
return FACTORY.getScriptEngine(args, loader);