aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Issue running a batch file from ANT target Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Issue running a batch file from ANT target" Watch "Issue running a batch file from ANT target" New topic
Author

Issue running a batch file from ANT target

Saurabh Joshi
Ranch Hand

Joined: Nov 15, 2007
Posts: 37
Hi,

I am trying to run the below target from a ant file:


But I am not able to run the batch file where as if I run the same batch file with same parameters directly on the command prompt it runs fine.

inspect.bat can be only run from intellij_binDir

I don't know what to do.

Please help.
Thanks,
Saurabh.
[ June 13, 2008: Message edited by: Saurabh Joshi ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

But I am not able to run the batch file


What error do you see?


[My Blog] [JavaRanch Journal]
Saurabh Joshi
Ranch Hand

Joined: Nov 15, 2007
Posts: 37
Hi Jai,
I don't get any error but I can say that the inspect.bat is not executing as I don't get the output file which I am getting while running it directly through command prompt.

And just to bring to your notice, I can run the inspect.bat only through the intellij_binDir directory, So is my approach correct to run the inspect.bat from this specific dir.
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
Why don't you specify the bat file in executable parameter of the exec task? Have you tried it?


[ June 13, 2008: Message edited by: Rodrigo Lopes ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

Originally posted by Saurabh Joshi:

I don't get any error but I can say that the inspect.bat is not executing as I don't get the output file which I am getting while running it directly through command prompt.



Does the bat file expect a output dir param? If not, it probably writes to the "current dir" from which the process was triggered. If you know the output filename, you can search for that file on your system and see if it got generated in some other folder than the one in which you are expecting it to be.

Originally posted by Saurabh Joshi:
And just to bring to your notice, I can run the inspect.bat only through the intellij_binDir directory, So is my approach correct to run the inspect.bat from this specific dir.


The "exec" task accepts a dir attribute. Does the code in the bat file assume that it is always going to run from the intellij_binDir folder? If the bat file has no such assumptions, then you can place the bat file in some other directory and pass that dir path to the exec task.
Saurabh Joshi
Ranch Hand

Joined: Nov 15, 2007
Posts: 37
Hey thanks to both of you for immediate response

Rodrigo: I tried your solution, that was good but it didn't help me.

Jai: Yes the 3 parameters given are mandatory which includes the last one as output dir. And it is compulsory to run the batch file from the specified dir.

Saurabh.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

Run Ant using the -v flag. It will print out additional log messages. See if those help in figuring out what the problem is.
Saurabh Joshi
Ranch Hand

Joined: Nov 15, 2007
Posts: 37
What I believe is it is not able to go to the intellij_binDir directory to execute the batch file.
Saurabh Joshi
Ranch Hand

Joined: Nov 15, 2007
Posts: 37
Hey Jai the -v option was very helpful.

I figured out the issue going on.
Thanks buddy.
 
wood burning stoves
 
subject: Issue running a batch file from ANT target