Here you can find the source of executeScript(String strScript)
public static void executeScript(String strScript) throws ScriptException
//package com.java2s; //License from project: Apache License import javax.script.*; public class Main { public static void executeScript(String strScript) throws ScriptException { // create a script engine manager ScriptEngineManager factory = new ScriptEngineManager(); // create a JavaScript engine ScriptEngine engine = factory.getEngineByName("JavaScript"); // evaluate JavaScript code from String engine.eval(strScript);// w w w .j a v a2 s .com } }