1 Reply Latest reply: Nov 25, 2007 6:14 AM by 796254 RSS

    Invoking a batch file from a java Program(I have problems wid runtime.exec)

    807603
      I need to invoke a batch file fom my java program, the batch file in turn invokes an encryption tool to ecnrypt files (using its command line command). The encryption process takes some 20 seconds to complete and my java program doesnt wait for it to complete*.
      The encryption is not done fully and the files get corrupted. The following is the piece of code is used

      proc = rt.exec("cmd.exe /c "+batfileloc+"downtempbat.bat");
      Thread.sleep(60000);

      I gave sleep after it, but sleep does not have any effect, by the time the execution reaches sleep, the processs is killed already.

      Please help me in this, its been giving me a lot of problem