Java exec execCmd(String cmd)

Here you can find the source of execCmd(String cmd)

Description

exec Cmd

License

Open Source License

Declaration

public static int execCmd(String cmd) throws IOException 

Method Source Code


//package com.java2s;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static int execCmd(String cmd) throws IOException {
        Process p = Runtime.getRuntime().exec(cmd);
        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = null;/*from ww  w. ja va  2  s .  c o m*/
        while ((line = in.readLine()) != null) {
            System.out.println(line);
        }
        return 0;
    }
}

Related

  1. exec(String... command)
  2. exec(String... command)
  3. exec(String[] args)
  4. execAdbCmd(String cmd)
  5. execAndGetOutput(ProcessBuilder builder)
  6. execCmd(String cmd)
  7. execCmd(String cmd, File where)
  8. execCmd(String command)
  9. execCmdWindows(String cmd)