The Java Shell REPL's line input on Windows doesn't behave the way line input behaves in most other Windows console applications:
- The Ctrl+Left Arrow key combination does not go to the start of the previous line.
- The End-of-File character is Ctrl+D (like Unix) instead of Ctrl+Z.
- The cursor disappears when scrolling using the horizontal arrow keys.
- While typing there is a short lag (about 0.1s) until each letter typed appears.
This happens with both Java 9 and 10. By contrast, the Kotlin REPL does not exhibit this strange behaviour. Nor do Java's BufferedReader.readLine()
or Scanner.nextLine()
methods when using System.in
, or System.console().readLine()
.
My questions:
Why is the Java Shell using this kind of line input? (I mean does it provide any particular benefit to compensate for it being harder to use?)
Is there a configuration to tell it to use the normal method of user input?
What Java API method is it using to read the user input (just so I can remember not to use it myself)?