I'm piping a text file into a java program. This is what the text file "input.txt" holds:
4
5
That is, the numbers 4 and 5 in seperated lines. I want the program to read those numbers and print them out. This code should work:
public class readFile {
public static void main(String[] args) {
while (!StdIn.isEmpty()) {
System.out.println( StdIn.readInt() );
}
}
}
But when I do the following in DrJava:
run readFile < input.txt
I don't get
4
5
but I get a box asking me for input instead of printing the numbers out: http://oi50.tinypic.com/3585kxc.jpg
What am I doing wrong?