Java Script Engine compile(ScriptEngine engine, String script)

Here you can find the source of compile(ScriptEngine engine, String script)

Description

compile

License

Apache License

Declaration

public static CompiledScript compile(ScriptEngine engine, String script) throws ScriptException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.ScriptEngine;

import javax.script.ScriptException;

public class Main {

    public static CompiledScript compile(ScriptEngine engine, String script) throws ScriptException {
        if (engine instanceof Compilable) {
            Compilable compEngine = (Compilable) engine;
            return compEngine.compile(script);
        }//from  w  ww.j  av a  2s  .com
        return null;
    }
}

Related

  1. createNashornEngine()
  2. evaluateScriptResource(ScriptEngine engine, String resource)
  3. getAppleScriptEngine()
  4. getAvailableEngineGroups()