Re: print before take Scanner input not working

2020-12-18 Thread Peter
This was introduced sometime after Maven 3.3.9 (after Netbeans 11.1). Running 
Netbeans 12.1 with Maven from Netbeans 11.1 is a work around.

On 2020/12/16 18:11:31, "Christopher C. Lanz"  
wrote: 
> Hello,
> 
> For many years, and both with NetBeans and with just a terminal, I have used 
> methods like this, to prompt the user to enter (say) an integer:
> 
> public static int inkeyInteger( String message ){
> 
> System.out.print( message );
> Scanner console = new Scanner(System.in);
> return console.nextInt();
> 
> }
> 
> Now in NetBeans 12, this code fails - the message is not printed until after 
> the user supplies data to the Scanner.
> 
> I have tried all the possible orderings of these 3 lines of code, and passing 
> the Scanner, etc. etc. I have searched StackOverflow.
> 
> It can be worked around if I print the message before calling a method 
> containing the scanner definition and next() call. This will require changing 
> hundreds of method calls throughout a large program.
> 
> Is there a workaround or patch etc.?
> 
> 
> Chris Lanz
> 
> Department of Computer Science
> 
> 340 Dunn Hall, SUNY Potsdam
> 
> lan...@potsdam.edu
> 
> 315 267 2407
> 
> 315 268 1547
> 
> 
> Nature and nature's laws lay hid in night:
> God said, Let Newton be! and all was light. (Pope)
> 
> It did not last: the Devil howling "Ho!
> Let Einstein be!" restored the status quo. (Squire)
> 
> 

-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Re: print before take Scanner input not working

2020-12-16 Thread Laszlo Kishalmi

The build tool is important here.

I think you are experiencing: NETBEANS-4617

The fix for that is in 12.2: https://github.com/apache/netbeans/pull/2270

It is marked to be backported to NetBeans 12.0-u2


On 12/16/20 10:11 AM, Christopher C. Lanz wrote:

Hello,

For many years, and both with NetBeans and with just a terminal, I 
have used methods like this, to prompt the user to enter (say) an integer:


public static int inkeyInteger( String message ){

    System.out.print( message );
    Scanner console = new Scanner(System.in);
    return console.nextInt();

}

Now in NetBeans 12, this code fails - the message is not printed until 
after the user supplies data to the Scanner.


I have tried all the possible orderings of these 3 lines of code, and 
passing the Scanner, etc. etc. I have searched StackOverflow.


It can be worked around if I print the message before calling a method 
containing the scanner definition and next() call. This will require 
changing hundreds of method calls throughout a large program.


Is there a workaround or patch etc.?

Chris Lanz

Department of Computer Science

340 Dunn Hall, SUNY Potsdam

lan...@potsdam.edu

315 267 2407

315 268 1547


Nature and nature's laws lay hid in night:
God said, /Let Newton be!/ and all was light. (Pope)

It did not last: the Devil howling "Ho!
Let Einstein be!" restored the status quo. (Squire)




print before take Scanner input not working

2020-12-16 Thread Christopher C. Lanz
Hello,

For many years, and both with NetBeans and with just a terminal, I have used 
methods like this, to prompt the user to enter (say) an integer:

public static int inkeyInteger( String message ){

System.out.print( message );
Scanner console = new Scanner(System.in);
return console.nextInt();

}

Now in NetBeans 12, this code fails - the message is not printed until after 
the user supplies data to the Scanner.

I have tried all the possible orderings of these 3 lines of code, and passing 
the Scanner, etc. etc. I have searched StackOverflow.

It can be worked around if I print the message before calling a method 
containing the scanner definition and next() call. This will require changing 
hundreds of method calls throughout a large program.

Is there a workaround or patch etc.?


Chris Lanz

Department of Computer Science

340 Dunn Hall, SUNY Potsdam

lan...@potsdam.edu

315 267 2407

315 268 1547


Nature and nature's laws lay hid in night:
God said, Let Newton be! and all was light. (Pope)

It did not last: the Devil howling "Ho!
Let Einstein be!" restored the status quo. (Squire)