Eclipse:语法错误,参数化类型仅在源级别为1.5时 [英] Eclipse: Syntax Error, parameterized types are only if source level is 1.5

查看:1353
本文介绍了Eclipse:语法错误,参数化类型仅在源级别为1.5时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用这个

ArrayList<String>
Map<String, String>

Eclipse抱怨两者:语法错误,参数化类型只有在源级别为1.5时。我使用JDK 1.6,但即使我去编译器并将合规性切换到1.5。它仍然给我这个错误。任何想法为什么?

Eclipse complain about both of them: Syntax Error, parameterized types are only if source level is 1.5. I use JDK 1.6, but even if I go to compiler and switch the compliance to 1.5. It still give me this error. Any Idea why?

推荐答案

我的猜测是,当您使用JDK 1.6运行eclipse本身时,实际上配置了不同的默认jre。

My guess would be that while you run eclipse itself with JDK 1.6, it's actually configured with a different default jre.

请参阅 Window-> preferences-> java->已安装的JREs ,并确保检查JRE是 1.6

See Window->preferences->java->Installed JREs and make sure that the checked JRE is 1.6.

如果默认的JRE确实为1.6,那么这是一个专门的项目设置。看到项目配置为使用正确的JRE。

If the default JRE is indeed 1.6, chances are that it's a project specific setting. See that the project is configured to use the right JRE.

这篇关于Eclipse:语法错误,参数化类型仅在源级别为1.5时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆