Page 1 of 1

java.io.IOException reading System.in

Posted: Mon Sep 15, 2003 4:50 pm
by bbadmin
One of the configuration options for TextPad's user tools is Capture output. This is nice, because it has the effect of redirecting the tool's standard output channel to the Command Results window. However, TextPad does not pass on any keystrokes to the tool's standard input channel, so if you have some code like this:

Code: Select all

    System.out.print("Enter your name: ");
    name = new BufferedReader(new InputStreamReader(System.in)).readLine();
readLine will fail with java.io.IOException, because it does not have ownership of the keyboard. You must run the application in a console window, if it needs any keyboard input, so do not check Capture output for the Run Java Application tool.

Keith MacDonald
Helios Software Solutions

Posted: Sat Feb 16, 2008 8:47 am
by klangenfarben
nice catch.