You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jaki <ja...@infosys.com> on 2008/09/12 16:32:15 UTC

Setting env var using ant

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Setting env var using ant

Posted by Andrew Goktepe <an...@gmail.com>.
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 <ja...@infosys.com> 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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>