Executing "cmd" is only possible if you have that executable, which is the 
usual case on Windows. Because of your project paths "/" I think you are 
working on Unix, so the shell executable would be "sh" or something like that.

But you cannot change the current directory.
What your <exec> would do is
- creating a new process for "cmd"
- because of not specifying the <exec dir=""> it is the current directory
- cmd will start with "/c cd /tmp"
- then cmd will exit!

Instead of trying Ant to change the dir, try adding the dir to the action it 
should do ... btw, what is the action you want to do in /tmp?


Jan

> -----Ursprüngliche Nachricht-----
> Von: Irfan Sayed [mailto:irfu.sa...@gmail.com] 
> Gesendet: Montag, 29. März 2010 09:50
> An: user@ant.apache.org
> Betreff: changing directory in Ant
> 
> Hi all,
> 
> i need to change the directory while executing build.xml. i executed
> following code.
> 
> <target name="dirchange">
> <exec executable="cmd">
>                         <arg value="/c"/>
>                         <arg value="cd"/>
>                         <arg value="/tmp"/>
> </exec>
> </target>
> 
> but it is failing with the following error.
> 
> Buildfile: build.xml
> dirchange:
> BUILD FAILED
> /home/y/var/builds/workspace/DNA_Renaissance_Aggs/V08/trunk/bu
> ild.xml:33:
> Execute failed: java.io.IOException: Cannot run program "cmd":
> java.io.IOException: error=2, No such file or directory
> Total time: 0 seconds
> please advice
> 
> Regards
> Irfan.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to