Obtain ScriptEngine : ScriptEngines « Development « Java Tutorial






import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class ObtainScriptEngine {
  public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();

    ScriptEngine engine1 = manager.getEngineByExtension("js");
    System.out.println(engine1);

    ScriptEngine engine2 = manager
        .getEngineByMimeType("application/javascript");
    System.out.println(engine2);

    ScriptEngine engine3 = manager.getEngineByName("rhino");
    System.out.println(engine3);
  }
}








6.48.ScriptEngines
6.48.1.Obtain ScriptEngine
6.48.2.Enumerate ScriptEngines
6.48.3.Function Evaluator
6.48.4.Bindings And Scopes
6.48.5.Pass value and get return value from script
6.48.6.Temperature Conversion with script
6.48.7.Test Compilation Speed
6.48.8.Threading Behavior