| Author |
Scanner class doubt
|
Jas Oberai
Ranch Hand
Joined: Jan 16, 2005
Posts: 231
|
|
Hi Friends, I have this scanner program which I am trying to run: I upgraded my jdk to 1.5 from 1.4.2 to run this program,but still getting this error.I also changed java_home and path accordingly,please help: C:\>javac display.java display.java:1: cannot resolve symbol symbol : class Scanner location: package util import java.util.Scanner; ^ display.java:8: cannot resolve symbol symbol : class Scanner location: class test Scanner sc = new Scanner( System.in ); ^ display.java:8: cannot resolve symbol symbol : class Scanner location: class test Scanner sc = new Scanner( System.in ); ^ 3 errors C:\>java -version java version "1.5.0_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05) Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing) Thanks
|
SCJP 1.4 (88%)<br />SCWCD 1.4 (88%)
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Well it is almost certainly a confusion between 1.4.2. (which as you know doesn't have a Scanner class) and 1.5. Echo the path before running your javac command - perhaps you are not using the javac you thought you were. Have all the 1.4.2 references been removed from the path?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
Originally posted by Paul Sturrock: Well it is almost certainly a confusion between 1.4.2. (which as you know doesn't have a Scanner class) and 1.5. Echo the path before running your javac command - perhaps you are not using the javac you thought you were. Have all the 1.4.2 references been removed from the path?
Nope. http://forum.java.sun.com/thread.jspa?threadID=666163
|
 |
Jas Oberai
Ranch Hand
Joined: Jan 16, 2005
Posts: 231
|
|
Thanks Paul and Steve, Infact as you said it was a path problem..I had both jdk versions on it...and after removing one of them i.e1.4.2 everything went off smoothly. Thanks
|
 |
 |
|
|
subject: Scanner class doubt
|
|
|