openjdk 1.7在eclipse中:运算符不允许源级低于1.7 [英] openjdk 1.7 in eclipse: operator is not allowed for source level below 1.7

查看:616
本文介绍了openjdk 1.7在eclipse中:运算符不允许源级低于1.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse给我一个错误:

 '<>'运算符不允许源级低于1.7 

我猜这是因为它不使用java 1.7。除了它是。至少openjdk 1.7(我的操作系统是OpenSuse 12.3)。



我从开普勒切换到juno以减少一些延迟,并尝试找出这个错误,到目前为止。


- eclipse的默认运行时是opensdk 1.7(在帮助中,有关安装的详细信息)
- 项目属性,java构建 - >库。我已经手动添加了opensdk的位置。



我将安装oracle版本,但opensuse存储库中只有1.6版本可用。我已经尝试安装由oracle提供的rpm,这没有把自己放在我的路径和一切搞乱的一切,所以我再次删除了。



它应该与openjdk一起工作吗?或者你认为它有一个错误?



ps:junit也没有被识别,所以我手动链接到jar文件。也许这是相关信息。

解决方案

在项目的首选项中,您必须设置编译器 选项到 1.7 - 目标选项到 1.7 也。有专门的选项框。



右键单击项目。选择属性。选择左侧的 Java编译器。为编译器合规级别选择 1.7 。如果下面的2个下拉菜单不是 1.7 ,请取消选中使用默认合规性设置,并将其设置为 1.7


Eclipse gives me an error:

'<>' operator is not allowed for source level below 1.7 

I guess this is because it is not using java 1.7. Except that it is. At least openjdk 1.7 (my OS is OpenSuse 12.3).

I switched back from kepler to juno to reduce some lags and try to figure out this bug as well, to no avail so far.

Some things I have tried: - the default runtime for eclipse is opensdk 1.7 (says so in help, about, installation details) - project properties, java build -> library. I have manually added the opensdk location.

I would install the oracle version, but there is only 1.6 available from the opensuse repository. I already tried installing the rpm offered by oracle, that didn't put itself in my path and kind of messed everything up, so I removed that again.

It should work with openjdk as well no? Or do you think it has a bug?

ps: junit also was not recognised, so I manually linked to the jar file. Perhaps this is relevant information.

解决方案

In your project's preferences, you must set the compiler --source option to 1.7 and --target option to 1.7 also. There are dedicated option boxes for that.

Right-click on the project. Choose Properties. Choose Java Compiler on the left. Choose 1.7 for the Compiler Compliance level. If the 2 drop-downs below that aren't 1.7, uncheck Use default compliance settings and set those to 1.7.

这篇关于openjdk 1.7在eclipse中:运算符不允许源级低于1.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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