Forums Register Login

Accessing the java.util.Scanner Utility

+Pie Number of slices to send: Send
Question about using the older versions of Java:

I think this is the version of my Java development kit software: j2sdk1.4.2_13

Since this is an older version I've been told that I don't have certain utilities such as the java.util.Scanner. Is this true or am I just not accessing the utility correctly in the development kit?

When I move the development kit to the right directory to coordinate with my Environment Variable, the program can still not access the Scanner utility.
+Pie Number of slices to send: Send
If you go the javadoc for the Scanner class (or any class for that matter) and then go to the end of the description section (just before the list of constructors) you will see something like

Since:
1.5

This is the earliest version of Java that the class is in. If there is no entry like this, then the class has always been in the API.
+Pie Number of slices to send: Send
 

Since this is an older version I've been told that I don't have certain utilities such as the java.util.Scanner. Is this true or am I just not accessing the utility correctly in the development kit?



This is true. If you look at javadoc for java.util.Scanner class (http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html), and search 'Since' on that page, you would see 1.5 written there. That means this class was added in jdk 1.5 version.
+Pie Number of slices to send: Send
Now that you know how to set up a PATH, you can download a newer version of Java from the Downloads site. You want the one called Java SE Development Kit (JDK) 6 Update 10, and the corresponding PATH entry will read something like

C:\Program Files\Java\jdk1.6.0_10\bin

if you use the default location. Remember it is called development kit, not runtime environment.

Once you have got that working, you will have the Scanner class available.
+Pie Number of slices to send: Send
Thanks All!

Campbell, I may need your help if I can't figure out how to set the Environment Variable correctly for the new install. If you I do the steps like last time, maybe it'll go smoothly but we'll see...

<keeping fingers crossed>
+Pie Number of slices to send: Send
That since bit never registered for me to find in which version a Class was included.

But here's the bummer.. the JSE 5 docs say since 1.5 and JSE 6 docs say since 1.6.. whom are we to believe?
+Pie Number of slices to send: Send
 

Originally posted by Gamini Sirisena:

But here's the bummer.. the JSE 5 docs say since 1.5 and JSE 6 docs say since 1.6.. whom are we to believe?



No they don't. At the very bottom of the page for the 1.6 docs, it says "Since 1.6", but that's part of the description of the "reset()" method, which was added to Scanner in JDK 1.6. Much closer to the top of the page, in the description of the class itself, right after " Whitespace is not significant in the above regular expressions", it says "Since 1.5" on both pages.
+Pie Number of slices to send: Send
 

Originally posted by Gamini Sirisena:
That since bit never registered for me to find in which version a Class was included.

But here's the bummer.. the JSE 5 docs say since 1.5 and JSE 6 docs say since 1.6.. whom are we to believe?



Huh?? They both say since 1.5. Where are you looking?
+Pie Number of slices to send: Send
 

Originally posted by Gamini Sirisena:
That since bit never registered for me to find in which version a Class was included.

But here's the bummer.. the JSE 5 docs say since 1.5 and JSE 6 docs say since 1.6.. whom are we to believe?



Actually both docs says the class is there since 1.5. There are some methods in the 1.6 docs that have only been there since 1.6
+Pie Number of slices to send: Send
Right, got it.
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1706 times.
Similar Threads
Whats the diff between jdk and sdk?
Is java 1.5 (5.0) java 2 ?
Byte[] to image
NoSuchMethodError while accessing Entity bean via a Struts Action
Decorator Pattern ??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:04:08.