LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2006, 12:22 AM   #1
pda_h4x0r
Member
 
Registered: Feb 2006
Location: somewhere in cyberspace
Distribution: Debian, Familiar
Posts: 380

Rep: Reputation: 31
Where is java.util.Scanner?


Hello everyone,

I'm in a java class and I'm trying to do my homework on my linux machine. However, the class Scanner in java.util is nowhere to be found! Can anyone tell me where it could be (or where it could be downloaded)?

Thank you
 
Old 08-25-2006, 01:02 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Make sure you have the Sun JDK 1.5: java.util.Scanner wasn't available in 1.4.x or any earlier release:

http://java.sun.com/j2se/1.5.0/docs/...l/Scanner.html
 
Old 08-25-2006, 09:45 AM   #3
pda_h4x0r
Member
 
Registered: Feb 2006
Location: somewhere in cyberspace
Distribution: Debian, Familiar
Posts: 380

Original Poster
Rep: Reputation: 31
That explains it--I was using 1.4.2.

Thank you
 
Old 11-14-2006, 11:11 AM   #4
tuxhats
Member
 
Registered: Dec 2005
Location: Austin, Texas area
Distribution: I have multiple Distos available, but I mostly use Ubuntu.
Posts: 47

Rep: Reputation: 16
java.util.Scanner

I can't get this class(java.util.Scanner) to work. I have:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

Got any answers?
Thanks!
 
Old 11-14-2006, 12:29 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
tuxhats -

Could you please specify "what's not working"?????
 
Old 10-29-2007, 04:59 PM   #6
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 387

Rep: Reputation: 33
Hello,

I have the same problem.

When I issue java -version I get:
Code:
rug@rug-lap:~$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
Java HotSpot(TM) Server VM (build 1.5.0_13-b05, mixed mode)
I'm using Eclipse. I've changed the compiler compliance to 5.0. How should I go about debugging this problem.

Any help is appreciated.

Thanks,
vxc
 
Old 10-29-2007, 05:07 PM   #7
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 387

Rep: Reputation: 33
Ok I did some digging around.

I found out that I have to issue the following to make sure Sun's version of Java is being used instead of GCJ:

As root:
Code:
update-java-alternatives -s java-1.5.0-sun
Then make sure that in /etc/jvm that the following line is on top:
Code:
/usr/lib/jvm/java-1.5.0-sun
Then in /etc/eclipse/java_home edit the file and make sure the following line is on top:
Code:
/usr/lib/jvm/java-1.5.0-sun
The above applies to ubuntu but it should work for most 'endians.

HOWEVER, this didn't really stop the error. Eclipse still says it cannot resolve java.util.Scanner.


Thanks again for any help,
vxc

Last edited by vxc69; 10-29-2007 at 05:17 PM.
 
Old 10-29-2007, 05:25 PM   #8
vxc69
Member
 
Registered: Jul 2004
Distribution: Ubuntu
Posts: 387

Rep: Reputation: 33
Ok ok I got it to work. On Eclipse, you need to go to Project>Properties then click on the Library tab and add the JRE Library as in /usr/lib/jvm/java-1.5.0-sun/jre.

Hope that helps for anyone who comes down this path.


Cheers,
vxc
 
Old 11-12-2007, 03:53 PM   #9
deja
LQ Newbie
 
Registered: Nov 2007
Posts: 1

Rep: Reputation: 0
Oh god thank you so much. You just saved my ass.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Scanner help.. failed to open device snapscan/dev/usb/scanner johnathan Linux - Hardware 2 10-12-2007 06:06 PM
java.util.*; in Linux? vmlinuz.gz Programming 3 04-05-2006 02:26 PM
backup util jcombs_31 Slackware 2 01-13-2005 11:50 AM
Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) Ethan Programming 5 02-06-2004 09:55 PM
Help debuggin telnet util.!!! nub47 Programming 1 12-19-2003 01:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration