Environment variables available to Ant must be set in the caller's
environment *before* launching the Ant Java process.  So the answer is no,
you cannot set an environment variable within an Ant script the way you
might set one in a shell script.  If you are <exec>ing another command you
can set variables with nested <env>s but that is probably not what you are
looking for.  If you need to compile with different JDKs the "executable"
attribute of <javac> allows for use of different JDK paths.  Most other
things would require <exec> to change JAVA_HOME.

See also:
http://www.nabble.com/Setting-environment-variables-td18781763.html
http://www.jguru.com/forums/view.jsp?EID=1154289

-Andrew

On Fri, Sep 12, 2008 at 7:32 AM, jaki <[EMAIL PROTECTED]> wrote:

>
> Is there any task which allows you to set environment variables like
> JAVA_HOME using ant?
> --
> View this message in context:
> http://www.nabble.com/Setting-env-var-using-ant-tp19457135p19457135.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to