I have this java code:
import java.util.Scanner;
public class Main {
public static void main(String [] args) {
Scanner in = new Scanner(System.in);
String line;
while (in.hasNextLine()) {
line = in.nextLine();
}
}
}
And I run it from jar file using ant:
<target name="run" depends="compile">
<java jar="./myfile.jar" fork="true"/>
</target>
But when I hit Ctrl+D on keyboard, the while loop does not break. How can I detect EOF from keyboard when I am using ant tool?