Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue running a batch file from ANT target

 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I am not able to run the batch file


What error do you see?
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I believe is it is not able to go to the intellij_binDir directory to execute the batch file.
 
Saurabh Joshi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Jai the -v option was very helpful.

I figured out the issue going on.
Thanks buddy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic