2

I run a batch command from Java like this:

String command ="cmd /c " + mPathToZip + " a -tzip " + source
            + "foo.zip " + source + "* && exit";
    try {
        Runtime.getRuntime().exec(command).waitFor();
    } catch (IOException e) { // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } 

So basically I need it to run the command and wait until it's finished before I do something else.

The problem is the JVM gets stuck at the Runtime.getRuntime().exec(command).waitFor();

I already tried this when unzipping something and works fine, but now when I zip something it gets stuck. Also, I've tried the command manualy and it works.

Any help is appreciated as I am new to threads.

0 Answers0