Java exec executeAndWait(String command)

Here you can find the source of executeAndWait(String command)

Description

execute And Wait

License

Apache License

Declaration

private static void executeAndWait(String command) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

public class Main {
    private static void executeAndWait(String command) throws IOException {
        try {/*from  w w w. j  ava  2 s. c o  m*/
            Process proc = Runtime.getRuntime().exec(command);
            int returnCode = proc.waitFor();
            if (returnCode != 0) {
                throw new IllegalStateException(
                        "Could not execute " + command + ", process returned " + returnCode);
            }
        } catch (InterruptedException e) {
            throw new IllegalStateException("Could not create execute command " + command, e);
        }
    }
}

Related

  1. execute(String[] command, File directory, String[] env)
  2. execute(String[] commandArray)
  3. execute(Template template, Map rootMap)
  4. execute1(final String appPath)
  5. execute2(final String appPath)
  6. executeApplication(String filePath)
  7. executeBashScriptWithParams(ArrayList script)
  8. executeBatFile(String batFile)
  9. executeCD(String dirPath)