LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Where is java.util.Scanner? (https://www.linuxquestions.org/questions/programming-9/where-is-java-util-scanner-477163/)

pda_h4x0r 08-25-2006 12:22 AM

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

paulsm4 08-25-2006 01:02 AM

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

pda_h4x0r 08-25-2006 09:45 AM

That explains it--I was using 1.4.2.

Thank you

tuxhats 11-14-2006 11:11 AM

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!
:Pengy:

paulsm4 11-14-2006 12:29 PM

tuxhats -

Could you please specify "what's not working"?????

vxc69 10-29-2007 04:59 PM

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

vxc69 10-29-2007 05:07 PM

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

vxc69 10-29-2007 05:25 PM

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

deja 11-12-2007 03:53 PM

Oh god thank you so much. You just saved my ass.


All times are GMT -5. The time now is 11:42 PM.