aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes White space issue in exec command. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "White space issue in exec command." Watch "White space issue in exec command." New topic
Author

White space issue in exec command.

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
I am using exec task in ant.

<exec executable="cmd.exe">
<arg line="/C"/>
<arg line="${was.home}\versioninfo.bat"/>
</exec>

During run-time, ${was.home} resolved to c:\was51\Web Sphere\AppServer\bin,

So, I am getting the problem:
[exec] The system cannot find the path specified.

Does this mean I can't have space in the directory names?

thanks,
guru
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Depends on the application you are running. In this instance you could possible get away with adding quotation marks round your command. When I'm working on Windows I tend to use short format directory names everywhere, just as a safe guard.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
Thanks man.

Now,I have changed all my arg-line to arg-value like this:
<arg value="${was.home}\versionInfo.bat">

But, again failing with:
running:
[echo] c:\was51\Web Sphere\AppServer\bin
[exec] Current OS is Windows XP
[exec] Executing 'cmd.exe' with arguments:
[exec] '/C'
[exec] 'c:\was51\Web Sphere\AppServer\bin\versionInfo.bat'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'cmd.exe' with arguments:
'/C'
'c:\was51\Web Sphere\AppServer\bin\versionInfo.bat'

The ' characters around the executable and arguments are
not part of the command.
[exec] The system cannot find the path specified.

Thanks,
Guru
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Is this still a problem?

From the output you showed you weren't using either of Paul's suggestions, to use quotes or short names.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: White space issue in exec command.
 
Similar Threads
How to configure in Ant?
ant websphere wsstartserver
execute script in background with ANT
How to go to a partical directory
Building with ant from eclipse