8.10下,eclipse无法识别Scanner

编译打包和其他
回复
bdpaylm
帖子: 22
注册时间: 2008-12-08 23:00

8.10下,eclipse无法识别Scanner

#1

帖子 bdpaylm » 2008-12-13 17:26

如题,做了如下测试,请过目。
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
bdpaylm
帖子: 22
注册时间: 2008-12-08 23:00

Re: 8.10下,eclipse无法识别Scanner

#2

帖子 bdpaylm » 2008-12-13 17:51

自己顶阿。。
bdpaylm
帖子: 22
注册时间: 2008-12-08 23:00

Re: 8.10下,eclipse无法识别Scanner

#3

帖子 bdpaylm » 2008-12-13 18:15

:em20 :em20 :em20
bdpaylm
帖子: 22
注册时间: 2008-12-08 23:00

Re: 8.10下,eclipse无法识别Scanner

#4

帖子 bdpaylm » 2008-12-13 18:22

救命阿。。
头像
windwiny
帖子: 2254
注册时间: 2007-03-13 17:26

Re: 8.10下,eclipse无法识别Scanner

#5

帖子 windwiny » 2008-12-15 16:19

jdk 有问题吧
头像
zys521cool
帖子: 39
注册时间: 2009-01-14 15:35

Re: 8.10下,eclipse无法识别Scanner

#6

帖子 zys521cool » 2009-01-19 14:41

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
linux从此开始@喝着酒晒太阳~~~
deathado
帖子: 38
注册时间: 2009-01-10 19:33

Re: 8.10下,eclipse无法识别Scanner

#7

帖子 deathado » 2009-02-10 1:13

同问,如果不能解决的话,用bufferedreader太麻烦了。
yang8251540
帖子: 1
注册时间: 2009-04-05 11:55

Re: 8.10下,eclipse无法识别Scanner

#8

帖子 yang8251540 » 2009-04-05 15:04

我也是这样的问题阿 要怎么解决阿
foxsashimi
帖子: 1
注册时间: 2009-04-04 9:25

Re: 8.10下,eclipse无法识别Scanner

#9

帖子 foxsashimi » 2009-04-14 16:20

是啊~我也这样 咋解决 没人说么
头像
jiazheng2222
帖子: 7
注册时间: 2009-04-04 11:57

Re: 8.10下,eclipse无法识别Scanner

#10

帖子 jiazheng2222 » 2009-05-06 12:25

就是呀,有没有解决方法呀?
头像
jiazheng2222
帖子: 7
注册时间: 2009-04-04 11:57

Re: 8.10下,eclipse无法识别Scanner

#11

帖子 jiazheng2222 » 2009-05-06 20:51

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
头像
onpduo
帖子: 51
注册时间: 2009-07-23 22:22

Re: 8.10下,eclipse无法识别Scanner

#12

帖子 onpduo » 2009-07-30 11:02

谢谢11楼的兄弟,我开始也猜测是jdk,jre版本不匹配,但不知怎么弄~ :em06
Back to Fedora from Archlinux...
吾辈乃水人一枚,潜水日久。
noyear
帖子: 5
注册时间: 2009-09-23 20:44

Re: 8.10下,eclipse无法识别Scanner

#13

帖子 noyear » 2009-10-26 23:35

同样 问题,netbeans正常
糊精
帖子: 25
注册时间: 2008-04-07 15:13

Re: 8.10下,eclipse无法识别Scanner

#14

帖子 糊精 » 2009-10-31 20:24

我猜你是不是用了GIJ
试试sun-java-jre
回复