This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 57306 - NoSuchElementException with Scanner input.NextInt
Summary: NoSuchElementException with Scanner input.NextInt
Status: RESOLVED DUPLICATE of bug 47708
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-01 10:31 UTC by cminorusa
Modified: 2005-04-01 16:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cminorusa 2005-04-01 10:31:20 UTC
I am using 4.1beta with Java 1.5

Here is the code:
import java.util.Scanner;

public class Comparison {
    /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    
    int number1;
    int number2;
    
    System.out.print("Enter first integer: ");
    number1 = input.nextInt();
    
  }// end main
  
}// end class Comparison

_____________________________________________________

Here is the output:
init:
deps-jar:
compile:
run:
Exception in thread "main" java.util.NoSuchElementException
    at java.util.Scanner.throwFor(Scanner.java:817)
    at java.util.Scanner.next(Scanner.java:1431)
    at java.util.Scanner.nextInt(Scanner.java:2040)
    at java.util.Scanner.nextInt(Scanner.java:2000)
    at Comparison.main(Comparison.java:25)
Enter first integer: 
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

The IDE is not letting me respond to the input request of
"Enter first integer:" and then of course it is generating an exception due to 
no input reaponse.

Is there something I need to do to tell the output to allow me to respond 
before proceeding???

Thanks
Comment 1 Milos Kleint 2005-04-01 11:32:51 UTC
reassigning to ant.
Comment 2 Jan Chalupa 2005-04-01 16:52:39 UTC
This appears to be a duplicate of issue #47708. It was not possible to pass
command-line input to a running program in NB 4.1 Beta. It works in recent 4.1
builds.

*** This issue has been marked as a duplicate of 47708 ***