• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scanner class doubt

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic