8.10下,eclipse无法识别Scanner
-
- 帖子: 22
- 注册时间: 2008-12-08 23:00
8.10下,eclipse无法识别Scanner
如题,做了如下测试,请过目。
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,安装后,结果还是一样,实在是没有办法了,到社区求助,麻烦各位帮忙分析一下吧。。。
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,安装后,结果还是一样,实在是没有办法了,到社区求助,麻烦各位帮忙分析一下吧。。。
-
- 帖子: 22
- 注册时间: 2008-12-08 23:00
Re: 8.10下,eclipse无法识别Scanner
自己顶阿。。
-
- 帖子: 22
- 注册时间: 2008-12-08 23:00
-
- 帖子: 22
- 注册时间: 2008-12-08 23:00
- windwiny
- 帖子: 2254
- 注册时间: 2007-03-13 17:26
Re: 8.10下,eclipse无法识别Scanner
jdk 有问题吧
- zys521cool
- 帖子: 39
- 注册时间: 2009-01-14 15:35
Re: 8.10下,eclipse无法识别Scanner
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,安装后,结果还是一样,实在是没有办法了,到社区求助,麻烦各位帮忙分析一下吧。。。
我和你一样的问题阿Scanner cannot be resolved to a type
Scanner cannot be resolved to a type
linux从此开始@喝着酒晒太阳~~~
-
- 帖子: 38
- 注册时间: 2009-01-10 19:33
Re: 8.10下,eclipse无法识别Scanner
同问,如果不能解决的话,用bufferedreader太麻烦了。
-
- 帖子: 1
- 注册时间: 2009-04-05 11:55
Re: 8.10下,eclipse无法识别Scanner
我也是这样的问题阿 要怎么解决阿
-
- 帖子: 1
- 注册时间: 2009-04-04 9:25
Re: 8.10下,eclipse无法识别Scanner
是啊~我也这样 咋解决 没人说么
- jiazheng2222
- 帖子: 7
- 注册时间: 2009-04-04 11:57
Re: 8.10下,eclipse无法识别Scanner
就是呀,有没有解决方法呀?
- jiazheng2222
- 帖子: 7
- 注册时间: 2009-04-04 11:57
Re: 8.10下,eclipse无法识别Scanner
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
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
谢谢11楼的兄弟,我开始也猜测是jdk,jre版本不匹配,但不知怎么弄~
Back to Fedora from Archlinux...
吾辈乃水人一枚,潜水日久。
吾辈乃水人一枚,潜水日久。
-
- 帖子: 5
- 注册时间: 2009-09-23 20:44
Re: 8.10下,eclipse无法识别Scanner
同样 问题,netbeans正常
-
- 帖子: 25
- 注册时间: 2008-04-07 15:13
Re: 8.10下,eclipse无法识别Scanner
我猜你是不是用了GIJ
试试sun-java-jre
试试sun-java-jre