A DESCRIPTION OF THE PROBLEM :
While System.in works from a snippet entered directly at the jshell prompt, it does not work from inside a script file loaded using /open or on the command line. Specifically, when calling System.in.read() from inside a script file, it returns -1 (end of file) without waiting for input from the user.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a script file test.jsh containing the statement
System.out.println(System.in.read());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
jshell blocks until a line of text is entered and then prints the ASCII code of the first character.
ACTUAL -
jshell does not block; it prints -1 (indicating end of file) and shows a prompt.
---------- BEGIN SOURCE ----------
See above
---------- END SOURCE ----------
FREQUENCY : always
While System.in works from a snippet entered directly at the jshell prompt, it does not work from inside a script file loaded using /open or on the command line. Specifically, when calling System.in.read() from inside a script file, it returns -1 (end of file) without waiting for input from the user.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a script file test.jsh containing the statement
System.out.println(System.in.read());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
jshell blocks until a line of text is entered and then prints the ASCII code of the first character.
ACTUAL -
jshell does not block; it prints -1 (indicating end of file) and shows a prompt.
---------- BEGIN SOURCE ----------
See above
---------- END SOURCE ----------
FREQUENCY : always