Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

scanner clas

Thread view: 
memocan@gmail.com - 18 Sep 2005 21:12 GMT
hi,

I want to use the scanner class for user I/O and I am
using Eclipse. But the when I import java.util.* , eclipse
doesnt recognize the scanner class. Can you please specifically
tell me what I should download and could you also give a direct
link which will get me use the scanner class??

Thanks,
mehmet
Eric Jacoboni - 18 Sep 2005 23:09 GMT
> I want to use the scanner class for user I/O and I am
> using Eclipse. But the when I import java.util.* , eclipse
> doesnt recognize the scanner class.

java.util.Scanner class comes with Java 5.0 : you cannot use it with
previous SDK.

> Can you please specifically
> tell me what I should download and could you also give a direct
> link which will get me use the scanner class??

I think that "Scanner class" in Google will give you all the answers
you need.

Here's a simple example:

import java.util.Scanner;

public class TestScanner {   
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
               System.out.printf("Message : ");
        String mess = scanner.nextLine();
        System.out.printf("You wrote %s%n", mess);
    }
}

Signature

Éric Jacoboni, né il y a 1430524940 secondes

Thomas Fritsch - 18 Sep 2005 23:27 GMT
> I want to use the scanner class for user I/O and I am
> using Eclipse. But the when I import java.util.* , eclipse
> doesnt recognize the scanner class.
Class java.util.Scanner is available since Java 1.5.
I suspect that your Eclipse project is configured to have an older Java (1.4
for example).

> Can you please specifically
> tell me what I should download and could you also give a direct
> link which will get me use the scanner class??
To change it: open the "Properties" dialog for your project, select "Java
Build Path" - "Library" - "Edit", select an JRE 1.5 (may be you'll have to
add the JRE 1.5 first)

Signature

"TFritsch$t-online:de".replace(':','.').replace('$','@')

mehmet canayaz - 19 Sep 2005 00:41 GMT
Hi again,

I updated my jre to 1.5 and eclipse doesn't give error messages for the
scanner class now.
But when I try to run it as an application, I am getting these kinda
messages

java.lang.NoClassDefFoundError: jre1/5/0_05
Exception in thread "main"

no matter which application I try to run.

now what :) ??

thanks for your answer

mehmet canayaz
mehmet canayaz - 19 Sep 2005 01:22 GMT
Everything is OK now, I just reinstalled Eclipse and it works
perfectly,

thanks again,

mehmet canayaz
Roedy Green - 19 Sep 2005 06:27 GMT
>java.lang.NoClassDefFoundError
see http://mindprod.com/jgloss/caq.html

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

ChrisWSU - 19 Sep 2005 14:24 GMT
That error is more then likely to occur when you have your run settings
screwed up, where its not actually tring run the right thing.  Ive seen
that a lot...
Roedy Green - 18 Sep 2005 23:55 GMT
>hi,
>
[quoted text clipped - 6 lines]
>Thanks,
>mehmet

You would import java.util.Scanner;
not scanner.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 18 Sep 2005 23:56 GMT
>I want to use the scanner class for user I/O and I am
>using Eclipse. But the when I import java.util.*

I believe it is new in 1.5, so make sure you have the recent JDK.
See http://mindprod.com/jgloss/jdk.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.