Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Running a batch file with Runtime.exec

Thu Oct 30, 2008 9:37 pm

I am trying to run some batch files from java as part of our
acceptance testing framework, and unfortunately the only way I seem to
be able to run a batch file on windows is like this:

Runtime.getRuntime().exec("cmd /c start " + batchFile);

However, it opens a comman window and doesnt go away till I close it,
and the tests require manual intervention to finish.



Re: Running a batch file with Runtime.exec

Thu Oct 30, 2008 9:37 pm

exec () should work just passing the name of the batch file, provided,
of course, that the directory of the batch file is in the Windows PATH
environment variable.

Post a reply
  Related Posts  to : Running a batch file with Runtime.exec
 purpose of the Runtime class     -  
 character running automatically / jump /duck/ functions     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 Copy file to file in java code- implementation     -  
 getting file name of html input file tag using jsp     -  
 file descriptor vs file pointer     -  
 How to convert xml file to Pdf file using C     -  
 C++ File I/O     -  
 web.xml file     -  
 delete file in asp     -