Package com.scratchdisk.script

Examples of com.scratchdisk.script.ScriptEngine.compile()


      Function funObj) throws Exception {
    File baseDir = getDirectory(thisObj);
    ScriptEngine engine = ScriptEngine.getEngineByName("JavaScript");
    for (int i = 0; i < args.length; i++) {
      File file = new File(baseDir, Context.toString(args[i]));
      executeScript(engine.compile(file), engine.getScope(thisObj));
    }
  }

  /**
   * Loads and executes a set of JavaScript source files in a newly created
View Full Code Here


      Function funObj) throws Exception {
    File baseDir = getDirectory(thisObj);
    ScriptEngine engine = ScriptEngine.getEngineByName("JavaScript");
    for (int i = 0; i < args.length; i++) {
      File file = new File(baseDir, Context.toString(args[i]));
      executeScript(engine.compile(file), engine.createScope());
    }
  }

  /**
   * Maps a Java class to a JavaScript prototype, so this can be used
View Full Code Here

  public static com.scratchdisk.script.Script compile(File file)
      throws ScriptException, IOException {
    ScriptEngine engine = ScriptEngine.getEngineByFile(file);
    if (engine == null)
      throw new ScriptException("Unable to find script engine for " + file);
    com.scratchdisk.script.Script script = engine.compile(file);
    if (script == null)
      throw new ScriptException("Unable to compile script " + file);
    return script;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.