I'm reading standard input:
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for (;;) {
var line = br.readLine();
if (line == null) break;
System.out.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
System.err.println("Done.");
}
If I use this in a terminal:
java TheClass </path/to/file
... it works: the program runs to completion.
But under Eclipse, if I set the same file as standard input (Run Configurations>Common>Standard Input and output), the program reads the file but it hangs after the last line until I enter a Ctrl-D in the console window (and then terminates normally).
Also under Eclipse, if I use the file directly (FileInputStream) the file is read to the end and the program terminates immediately.
Am I missing something or is this an Eclipse problem?
Using Eclipse 2020-06 on Linux with openjdk 11.