cannot resolve symbol Scanner

Hi all,

i am using the Scanner class, while compiling i got an error cannot resolve the symbol Scanner. i checked my j.dk version also and it's 1.6

syntax:

File file = new File(fileName);

Scanner scanner = new Scanner(file);

error:

TextScanner.java:10: cannot resolve symbol

symbol : class Scanner

location: class TextScanner

Scanner scanner = new Scanner(file);

java version "1.6.0_01"

Java(TM) SE Runtime Environment (build 1.6.0_01-b06)

Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing).

any help is appreciated.

[621 byte] By [lokesh_madana] at [2007-11-27 9:09:50]
# 1
import the Scanner classimport java.util.Scanner;~Tim
SomeoneElsea at 2007-7-12 21:50:33 > top of Java-index,Java Essentials,New To Java...
# 2
i have already imported that class.
lokesh_madana at 2007-7-12 21:50:33 > top of Java-index,Java Essentials,New To Java...
# 3
> i have already imported that class.have you per chance imported any other scanner classes? Look closely.
petes1234a at 2007-7-12 21:50:33 > top of Java-index,Java Essentials,New To Java...
# 4
Hey Tim, i have figured that out. actually jdk 1.4 was also installed, once i removed that, the problem was resolved.anyways, thanks.
lokesh_madana at 2007-7-12 21:50:33 > top of Java-index,Java Essentials,New To Java...
# 5

> i have already imported that class.

C:\Testing\junk\src>javac -d ..\classes forums\java\sun\Test.java

forums\java\sun\Test.java:14: cannot find symbol

symbol : class Scanner

location: class forums.java.sun.Test

Scanner tester = new Scanner(System.in);

^

This is the error I got without the import statement. Notice that it is eeriely similar to the error you received.

Adding the above import fixed my problem. Make sure you are saving the file before trying to compile it, and that you are not compiling an older version.

~Tim

EDIT: well, that would do it also!

SomeoneElsea at 2007-7-12 21:50:33 > top of Java-index,Java Essentials,New To Java...