PrintStream ps;
try {
ps = new PrintStream("D:\role.txt");
System.setOut(ps);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
ps = new PrintStream("D:\role.txt");
System.setOut(ps);
} catch (FileNotFoundException e) {
e.printStackTrace();
}