www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
From: | "David P. Caldwell" <inonit AT inonit DOT com> |
To: | <chintu AT wam DOT umd DOT edu>, <cygwin AT cygwin DOT com> |
Subject: | Reading console input from Java under Cygwin shell (was Re: inputstream!) |
Date: | Mon, 25 Feb 2002 11:26:38 -0500 |
Message-ID: | <JIEPJODHFFPGJDGMCPBEAEFJCIAA.inonit@inonit.com> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) |
Importance: | Normal |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000 |
Pramod: >if i write a simple java program that uses a BufferedReader reader object >wrapped from System.in and then try to read a line from user and then echo >it back, cygwin for some reason already has stuff on the stream and so >without waiting for the user to type something in the program fetches that >and prints it out (it is usually) just a newline. why does this happen! The following code works on my system using JDK 1.4.0 and Windows 2000: * * * package test.io; import java.io.*; public class ConsoleInput { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.readLine(); System.out.println("Echo: " + s); } } * * * There are some issues with reading console input on Win 9x systems that have nothing to do with Cygwin. See, e.g., Java Developer Connection Bug #4071281 at http://developer.java.sun.com/developer/bugParade/bugs/4071281.html. Are you using a Windows 9x flavor? Silly question: Have you tried running it simply under DOS? -- David Caldwell. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |