Peter1
Nov 23rd, 2004, 03:30 PM
Hello.
I am using Netbeans 4.0 Beta 2 with JDK 1.5. With this simple, short code I am generating an error that I can't seem to figure out.
import java.util.*;
public class Main
{
public static void main (String [] args)
{
Scanner input = new Scanner(System.in);
String myName = input.next();
System.out.println(myName);
}
}
It builds fine, however when I run the program it generates this error message.
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1317)
at Main.main(Main.java:8)
Java Result: 1
Has anyone encountered this. I have reinstalled Netbeans and the JDK several times, but it still doesn't work.
Thanks for any help.
Pete
I am using Netbeans 4.0 Beta 2 with JDK 1.5. With this simple, short code I am generating an error that I can't seem to figure out.
import java.util.*;
public class Main
{
public static void main (String [] args)
{
Scanner input = new Scanner(System.in);
String myName = input.next();
System.out.println(myName);
}
}
It builds fine, however when I run the program it generates this error message.
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1317)
at Main.main(Main.java:8)
Java Result: 1
Has anyone encountered this. I have reinstalled Netbeans and the JDK several times, but it still doesn't work.
Thanks for any help.
Pete