Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;

import javax.script.ScriptContext;
import javax.script.SimpleScriptContext;

public class Main {
    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);
    }
}