• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

invoking a batch file from java code

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a scenario where i have to "invoke a batch file which internally invokes ant" from a java program.I used
Runtime proc= Runtime.getRuntime();
Process process=proc.exec("cmd /c <batch file path>");
process.waitFor();

it is not opening a new command prompt window and also the batch file is not being processed. Can any one throw light in this aspect.

Thanks in Advance.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the following code will ensure the execution of the batch file unless a proper path is not provide.



Ensure the execution of the batch by running it first in command prompt and then try with the program. You never know what errors are thrown.
reply
    Bookmark Topic Watch Topic
  • New Topic