设置 Ant 以使用不同于 JAVA_HOME 中指定的 JDK [英] Setup Ant to use JDK different from one specified in JAVA_HOME

查看:25
本文介绍了设置 Ant 以使用不同于 JAVA_HOME 中指定的 JDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,由于运行许多项目的原因,我不想更改 JAVA_HOME 变量(1.6),但我希望 ant 运行并使用 1.5 JDK.

So for reason of running many projects, I don't want to change JAVA_HOME variable (1.6) but I would like ant to run and use 1.5 JDK.

我已设法从 Eclipse IDE 执行此操作(因此可以完成),因此当从 Eclipse IDE 运行时,它将使用 1.5,因为我将 JDK 1.5 指定为项目的 JDK.

I have manage to do this from Eclipse IDE (so it can be done), so when running from Eclipse IDE it will use 1.5 since I specified JDK 1.5 as project's JDK.

长话短说,我希望 Ant 在从 cmd 提示符运行时使用 JDK 1.5.

To make long story short I want Ant when run from cmd prompt to use JDK 1.5.

看起来很简单,但我很难找到方法.

Seems pretty easy but I am having trouble finding out the way to do it.

附言

我需要它在命令提示符下工作的原因是因为 ant 构建需要 3-4 分钟,而且我的 Eclipse IDE 在运行时被冻结.三分钟的等待是不可接受的:)

Reason I need this to work from command prompt is because ant build is quite long 3-4 mins and my Eclipse IDE gets frozen while it's running. Three minutes waits are simply not acceptable :)

谢谢大家.

推荐答案

您可以编写自己的脚本,称为 ant2 或类似脚本,从您想要的 JDK 中执行 ant 并将其添加到 PATH 中.

You can write your own script, called ant2 or similar, to execute ant from the JDK that you want and add it into the PATH.

这篇关于设置 Ant 以使用不同于 JAVA_HOME 中指定的 JDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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