java.io.IOException reading System.in

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
bbadmin
Site Admin
Posts: 878
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

java.io.IOException reading System.in

Post 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
User avatar
klangenfarben
Posts: 11
Joined: Mon Jan 10, 2005 8:51 pm
Location: Brattleboro, Vermont, USA

Post by klangenfarben »

nice catch.
Post Reply