Ant 使用了错误的 Java 版本 [英] Ant is using wrong java version

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

问题描述

我使用的是 Ant 1.7.0 并安装了 JAVA_HOME 中的 java 1.6.

I'm using Ant 1.7.0 and installed java 1.6 which is in JAVA_HOME.

我想使用 java 1.5 构建一个项目,因此我已将 JAVA_HOME 导出为我的 java 1.5 目录.

I want to build a project using java 1.5, so I've exported JAVA_HOME to be my java 1.5 directory.

java -version

说1.5".当我运行 Ant 时,它使用 java 1.6.

says "1.5". When I run Ant it uses java 1.6.

推荐答案

刚遇到这个问题,这是因为当默认 JRE 为 1.6 时,我首先将构建文件添加到 ant-view.

Just had this issue, it happened because I'd first added the build file to the ant-view when the default JRE was 1.6.

没有特定于项目的 JRE,我将默认值更改为 1.5,即使 eclipse 运行在 1.5,而且 JAVA_HOME 也是 1.5.从命令行运行 ant 目标使用 JRE 1.5,但在 eclipse 中它仍然使用 1.6.

There was no project-specific JRE and I changed the default to 1.5, even eclipse was running in 1.5, and JAVA_HOME was 1.5 too. Running the ant target from the command line used JRE 1.5, but within eclipse it still used 1.6.

我必须右键单击 ant 目标,选择 Run As... 并更改 JRE 选项卡下的 JRE.此设置会被记住以供后续运行使用.

I had to right-click the ant target, select Run As... and change the JRE under the JRE tab. This setting is remembered for subsequent runs.

这篇关于Ant 使用了错误的 Java 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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