简体   繁体   English

Eclipse:javac:目标版本1.6与默认源版本1.7冲突

[英]Eclipse: javac: target release 1.6 conflicts with default source release 1.7

I am trying to perform a build on Eclipse Kepler but when I do so I get the following error javac: target release 1.6 conflicts with default source release 1.7 我正在尝试在Eclipse Kepler上执行构建,但是当我这样做时,我得到以下错误javac: target release 1.6 conflicts with default source release 1.7

I have changed the Java Compiler to use 1.6 but this warned me that the default JRE was 1.7. 我已经将Java编译器更改为使用1.6但是这警告我默认JRE是1.7。 I then went to Installed JREs removed 1.7 and created a new one for 1.6. 然后我去了已安装的JRE,删除了1.7并为1.6创建了一个新的。

This still gives the sames error. 这仍然会给出相同的错误。 I also saw something about adding -vm and the java path to eclipse.ini but this didnt help either. 我也看到了一些关于添加-vm和eclipse.ini的java路径的事情,但这也没有帮助。

Does anyone know what to do? 有谁知道该怎么办?

You may want to check the project or workspace's compiler settings and verify that the Java source and target versions are the same: 您可能需要检查项目或工作空间的编译器设置,并验证Java源和目标版本是否相同:

  1. Right click the project in the package explorer and select 'properties' 右键单击包浏览器中的项目,然后选择“属性”
  2. Select "Java Compiler" in the left pane. 在左窗格中选择“Java Compiler”。
  3. If "Enable project specific settings" is not set, then click on "Configure Workspace Settings..." 如果未设置“启用项目特定设置”,则单击“配置工作区设置...”
  4. Verify that the source and target are 1.6 if that's what you intend to use 如果您打算使用它,请验证源和目标是否为1.6

Here's a link to a similar error when using javac from the commandline: Can we use jdk7 javac to compile code with java7 features into java6 bytecode 这是从命令行使用javac时类似错误的链接: 我们可以使用jdk7 javac将java7特性的代码编译成java6字节码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM