[ACCEPTED]-What is the End Of File/Stream keyboard combination to use with System.in.read()-console-input

Accepted answer
Score: 14

Control + D should send the EOF character as excepted 3 , but it is an bug in Eclipse.

One of the 2 user reported as

    In Kepler 4.3 eclipse.buildId=4.3.0.M20130911-1000 on Linux the problem 
    still exists in the Java console. I found the following workaround:

    If you leave the console to focus on another view, and then refocus on the console,
    then Ctrl-D (EOF) works as expected.

Follow here


When using Eclipse 1 in Windows, Control + Z sends the EOF character.

Score: 1

Testing this out using Groovy in a Windows 8 command prompt, ctrl-D doesn't work while 7 ctrl-C does:

C:>groovy -e "while(v = System.in.read()){ println v }"
^D
4
13
10
-1
Terminate batch job (Y/N)? y

First I hit ctrl-D then enter, resulting 6 in output ctrl-D, 4, 13, 10 (the last three 5 being EOT, CR, LF, I guess, not sure what 4 ^D amounts to in this case). Then I tried 3 ctrl-C and the '-1' end-of-input was sent. So 2 it seems this is dependent on the shell 1 as Dev says.

More Related questions