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.
Hey Tim, i have figured that out. actually jdk 1.4 was also installed, once i removed that, the problem was resolved.anyways, thanks.
> 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!