From owner-freebsd-java@FreeBSD.ORG Fri Feb 27 14:20:30 2015 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A760BFD for ; Fri, 27 Feb 2015 14:20:30 +0000 (UTC) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44706E0 for ; Fri, 27 Feb 2015 14:20:29 +0000 (UTC) Received: from [89.204.154.46] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1YRLmE-0005Jh-1O; Fri, 27 Feb 2015 15:20:26 +0100 Received: from localhost.my.domain (c720-r276659 [127.0.0.1]) by localhost.unixarea.de (8.14.9/8.14.9) with ESMTP id t1REKHwt004483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 27 Feb 2015 15:20:19 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.14.9/8.14.9/Submit) id t1REKFkT004482; Fri, 27 Feb 2015 15:20:15 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Fri, 27 Feb 2015 15:20:14 +0100 From: Matthias Apitz To: freebsd-java@freebsd.org Subject: read unbuffered from STDIN Message-ID: <20150227142014.GA4468@c720-r276659> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , freebsd-java@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 11.0-CURRENT r269739 (i386) User-Agent: Mutt/1.5.23 (2014-03-12) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 89.204.154.46 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2015 14:20:30 -0000 Hello, I wnat to read chars from STDIN console as they are typed in and without waiting for \n. I tried with no luck somethink like this: //Use a BufferedReader to read characters from the console. import java.io.*; class reader { public static void main(String args[]) throws IOException { char c; System.out.println("Enter characters, 'q' to quit."); // read characters do { c = (char) System.in.read(); System.out.println(c); } while (c != 'q'); } } This does not work in FreeBSD+eclipse and as well not when started as $ javac reader.java $ java -cp . reader Any ideas? Thx matthias -- Matthias Apitz, guru@unixarea.de, http://www.unixarea.de/ +49-170-4527211 La referencia de la Duma a la anexión de la RDA, en este caso al contrario con la Crimlía sin referéndum, no solamente tiene gracia sino da en el blanco.- Marinos Yannikos @MarinosYannikos en un blog de RTdeutsch.