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: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists