使用Java 1.6运行Eclipse Mars [英] Run Eclipse Mars with Java 1.6

查看:181
本文介绍了使用Java 1.6运行Eclipse Mars的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了最新版本的Eclipse(Mars),并在eclipse.ini文件中将所需的Java版本更改为1.6,因为我的项目使用Java 1.6。



我配置在Eclipse中安装JRE以使用Java 1.6。
但是当我尝试执行我的ant目标时,会创建一个错误 - JRE版本小于1.7不支持。



是否有任何解决方法使用Java 1.6在Mars版本中,因为我目前无法升级到Java 1.7

解决方案

我面临同样的问题在升级到Eclipse Mars之后。



我通过将项目的外部工具配置的运行时环境更改为JDK7

来解决这个问题。 >

我假设你知道如何将JDK7添加到eclipse中安装的jre



打开外部工具配置...然后将JRE更改为JDK 1.7





然后更改JRE



< img src =https://i.stack.imgur.com/5KFrw.pngalt =更改JRE>



但这将创建另一个问题下,编译的jar将在JDK 7中,并且在使用JDK6的生产服务器上不起作用。



为了解决这个问题,只需将将任务中的目标属性更改为1.6



< javac target =1.6>





根据@dag和@Chris的建议,这里是更新的ant javac任务。


I downloaded the latest release of Eclipse (Mars) and changed the required Java version to 1.6 in eclipse.ini file as my project uses Java 1.6.

I configured installed JREs inside Eclipse to use Java 1.6. But when I try to execute my ant target it creates an error - "JRE version less than 1.7 is not supported".

Is there any workaround to use Java 1.6 in Mars version as I'm unable to upgrade to Java 1.7 at the moment ??

解决方案

I faced the same problem after upgrading to Eclipse Mars.

I solved this by changing the runtime environment of the external tool configuration of the project to JDK7.

I assume you know how to add JDK7 to your installed jre in eclipse

Open External Tools Configurations... and then change the JRE to JDK 1.7

Then change the JRE

But this will create another problem, the compiled jar will be in JDK 7 and this will not work on production servers with JDK6.

To solve this, simply change the target attribute in the task to be 1.6

<javac target="1.6">

As per suggested from @dag and @Chris, Here is updated ant javac task.

这篇关于使用Java 1.6运行Eclipse Mars的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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