You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ramesh M <ra...@yahoo.com> on 2006/01/18 13:34:11 UTC

Batch file execution fails on Win XP with java.io.Exception error=2

I have the folllowing fragment in an ant extension
class.

String executable =3D "somebatchfile";
commandline =3D new Commandline();
commandline.setExecutable(executable)
Command c =3D new Command(commandline);
c.displayPrompt();
c.setDir(testDomain);
c.displayMake();
c.run();

Where the "somebatchfile" comes from the build file.
It does not 
have any extension.
On executing it on Windows XP I get the following
error 
 Cannot execute C:\somebatchfile: java.io.IOException:

CreateProcess: C:\somebatchfile.sh error=3D2 . The
somebatchfile.cmd 
is available on the folder, but it looks like it is
looking for 
a .sh file by default. 
Any work around for this? The same works on Windows NT
& Solaris
(With a somebatchfile.sh in the folder).
Thanks,
Ramesh.

Regards,
Ramesh 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Batch file execution fails on Win XP with java.io.Exception error=2

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 18 Jan 2006, Ramesh M. <ra...@yahoo.com> wrote:

> Where the "somebatchfile" comes from the build file.  It does not
> have any extension.  On executing it on Windows XP I get the
> following error Cannot execute C:\somebatchfile:

You have to execute cmd.exe in order to run batch files without
extensions.  In general error=2 means "command not found" on Windows.

Stefan

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


Re: Batch file execution fails on Win XP with java.io.Exception error=2

Posted by Jeffrey E Care <ca...@us.ibm.com>.
Read the manual page for the <exec> task; it should give you a hint.

-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)


Ramesh M <ra...@yahoo.com> wrote on 01/18/2006 07:34:11 AM:

> I have the folllowing fragment in an ant extension
> class.
> 
> String executable =3D "somebatchfile";
> commandline =3D new Commandline();
> commandline.setExecutable(executable)
> Command c =3D new Command(commandline);
> c.displayPrompt();
> c.setDir(testDomain);
> c.displayMake();
> c.run();
> 
> Where the "somebatchfile" comes from the build file.
> It does not 
> have any extension.
> On executing it on Windows XP I get the following
> error 
>  Cannot execute C:\somebatchfile: java.io.IOException:
> 
> CreateProcess: C:\somebatchfile.sh error=3D2 . The
> somebatchfile.cmd 
> is available on the folder, but it looks like it is
> looking for 
> a .sh file by default. 
> Any work around for this? The same works on Windows NT
> & Solaris
> (With a somebatchfile.sh in the folder).
> Thanks,
> Ramesh.
> 
> Regards,
> Ramesh 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>