Quote:
Originally Posted by charlie0313
I switched back to Linux again and moved all my java projects onto my Ubuntu system. But when i try and import java.util.Scanner eclipse gives an error and doesn't know what Scanner is. I installed eclipse using apt-get install in Ubuntu. Below is what java -version prints out.
Code:
charlie@charlie-laptop:~$ java -version
java version "1.6.0_0"
IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12)
OpenJDK Server VM (build 1.6.0_0-b12, mixed mode)
Let me know if I need to give more info. Any suggestions would be great. Thanks
|
Hi charlie0313,
The first thing I would look at is if your project is using the correct JDK. To do so, right-click on your project, then
Properties > Java Compiler and make sure the JDK compliance is set correctly/and or specify a new one.
Remember that the Scanner class was added at Java 5, so if you are trying to build it with Java 1.4.x it won't work. If everything looks fine there, it may be a problem with the Eclipse you were using on your previous OS to the one you are using with Ubuntu.
I am not sure which Eclipse version is available on Ubuntu repositories, but I would recommend you to go to
www.eclipse.org and grab the latest one. It is just a zip file, so it does not require any installation and it won't interfere with your current installed Eclipse.
My last suggestion would be to create a new workspace and import your projects once again to see how it goes. Sometimes, my workspace gets messed up for some reason