You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "David Green (Jira)" <ji...@apache.org> on 2021/08/28 17:54:00 UTC
[jira] [Created] (NETBEANS-5961) System.out.print buffered to
Output Window
David Green created NETBEANS-5961:
-------------------------------------
Summary: System.out.print buffered to Output Window
Key: NETBEANS-5961
URL: https://issues.apache.org/jira/browse/NETBEANS-5961
Project: NetBeans
Issue Type: Bug
Affects Versions: 12.4, 12.5
Environment: JDK 15
macOS 11.5.2
Reporter: David Green
In NetBeans 12.4 and verified to also behave this way on NetBeans 12.5-beta2, System.out.print is buffered such that it does not show up in the NetBeans Output window until a System.out.println (or probably things like program end, and some buffer full scenario).
Example code:
{{package dgreen.printbug;}}
{{import java.util.Scanner;}}
{{/**}}
{{ * Demo program showing that System.out.print's are not pushed to output window until a}}
{{ * System.out.println}}
{{ */}}
{{public class NewMain {}}
{{ public static void main(String[] args) {}}
{{ Scanner sc = new Scanner(System.in);}}
{{ System.out.print("Enter your name: ");}}
{{ System.out.flush(); // should not be necessary but does not work either}}
{{ String name = sc.nextLine();}}
{{ System.out.println("Hi " + name);}}
{{ }}}
{{}}}
—-
{{Running it after Clean & Build (or before)}}
{{ }}
{{--- exec-maven-plugin:3.0.0:exec (default-cli) @ printbug ---}}
{{dave}}
{{Enter your name: Hi dave}}
------------------------------------------------------------------------
BUILD SUCCESS
where "dave" was typed in without the benefit of seeing the prompt.
This works fine when run from true command line either inside a NetBeans Terminal Window or the real command line.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists