Reassigns standard input stream (System.in) from a file
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class SystemExample {
public static void main(String[] args) throws IOException {
InputStream in = new FileInputStream(new File("c:\\temp\\out.log"));
System.setIn(in);
byte b[] = new byte[System.in.available()];
System.in.read(b);
System.out.println(new String(b));
}
}




















