List of usage examples for javax.script ScriptContext getReader
public Reader getReader();
Reader
to be used by the script to read input. From source file:Main.java
public static void main(String[] args) throws Exception { ScriptContext ctx = new SimpleScriptContext(); // Get the reader and writers from the script context Reader inputReader = ctx.getReader(); Writer outputWriter = ctx.getWriter(); Writer errWriter = ctx.getErrorWriter(); // Write all script outputs to an out.txt file Writer fileWriter = new FileWriter("out.txt"); ctx.setWriter(fileWriter);/*from www .j a va2s. c o m*/ }