java.io.IOException reading System.in
Posted: Mon Sep 15, 2003 4:50 pm
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:
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
Code: Select all
System.out.print("Enter your name: ");
name = new BufferedReader(new InputStreamReader(System.in)).readLine();
Keith MacDonald
Helios Software Solutions