Java exec executeProcess(final File workDir, final String... termArray)

Here you can find the source of executeProcess(final File workDir, final String... termArray)

Description

execute Process

License

BSD License

Declaration

public static Process executeProcess(final File workDir, final String... termArray)
        throws IOException, InterruptedException 

Method Source Code

//package com.java2s;
/**//from   ww  w .java 2  s  .c om
 * Copyright (C) 2013 Barchart, Inc. <http://www.barchart.com/>
 *
 * All rights reserved. Licensed under the OSI BSD License.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class Main {
    /***/
    public static Process executeProcess(final File workDir, final String command)
            throws IOException, InterruptedException {
        final String[] termArray = command.split("\\s+");
        return executeProcess(workDir, termArray);
    }

    /***/
    public static Process executeProcess(final File workDir, final String... termArray)
            throws IOException, InterruptedException {
        final List<String> termList = Arrays.asList(termArray);
        final ProcessBuilder builder = new ProcessBuilder(termList);
        final Process process = builder.directory(workDir).start();
        process.waitFor();
        return process;
    }
}

Related

  1. executeIt(String command)
  2. executeLocalCommand(String[] command)
  3. executeLS()
  4. executeMemoryInfoProcess(String... command)
  5. executeNativeCommand(String command)
  6. executeProcess(final String[] cmds)
  7. executeProcess(String command)
  8. executeProcessAndGetOutputAsStringList(final String command)
  9. executePUT(DataInputStream sockInp, DataOutputStream sockOutp)