分页: 1 / 1

8.10下,eclipse无法识别Scanner

发表于 : 2008-12-13 17:26
bdpaylm
如题,做了如下测试,请过目。
import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print("请输入: ");
String a = input.next();
System.out.print(a);
}
}

就是这几行代码,无法通过编译,提示如下:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type

开始以为是少了jdk,在新立德里找到了jdk6,安装后,结果还是一样,实在是没有办法了,到社区求助,麻烦各位帮忙分析一下吧。。。 :em19

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2008-12-13 17:51
bdpaylm
自己顶阿。。

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2008-12-13 18:15
bdpaylm
:em20 :em20 :em20

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2008-12-13 18:22
bdpaylm
救命阿。。

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2008-12-15 16:19
windwiny
jdk 有问题吧

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-01-19 14:41
zys521cool
bdpaylm 写了:如题,做了如下测试,请过目。
import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.print("请输入: ");
String a = input.next();
System.out.print(a);
}
}

就是这几行代码,无法通过编译,提示如下:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type

开始以为是少了jdk,在新立德里找到了jdk6,安装后,结果还是一样,实在是没有办法了,到社区求助,麻烦各位帮忙分析一下吧。。。 :em19

我和你一样的问题阿Scanner cannot be resolved to a type
Scanner cannot be resolved to a type

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-02-10 1:13
deathado
同问,如果不能解决的话,用bufferedreader太麻烦了。

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-04-05 15:04
yang8251540
我也是这样的问题阿 要怎么解决阿

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-04-14 16:20
foxsashimi
是啊~我也这样 咋解决 没人说么

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-05-06 12:25
jiazheng2222
就是呀,有没有解决方法呀?

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-05-06 20:51
jiazheng2222
ok ,now i have find the solution to solve this problem.
At first ,you should adjust your system to use the higher version jdk,so you should enter these codes:

Codes:
sudo update-java-alternatives -s java-6-sun

Then you should go into eclipse
->window
->preferences
->java
->installed jres
now click add

select stanard vm if that pops up not sure if that will be in your version of eclipse

click browse
go to /usr/lib/jvm/The Appropriate One Probably java-6-sun-1.6.0.10 or similar/

Then just make sure you deselect the other JREs and only have this one selected

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-07-30 11:02
onpduo
谢谢11楼的兄弟,我开始也猜测是jdk,jre版本不匹配,但不知怎么弄~ :em06

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-10-26 23:35
noyear
同样 问题,netbeans正常

Re: 8.10下,eclipse无法识别Scanner

发表于 : 2009-10-31 20:24
糊精
我猜你是不是用了GIJ
试试sun-java-jre