Java examples for Native OS:Shell Command
show Result Process
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.logging.Logger; public class Main{ private static final Logger LOG = Logger.getLogger(CMDUtil.class .getCanonicalName());//from w w w . j av a 2 s .c o m public static void showResultProcess(Process process) throws IOException { InputStream is = process.getErrorStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader bufferedReader = new BufferedReader(isr); String line; while ((line = bufferedReader.readLine()) != null) { System.out.println(line); LOG.info("logger: " + line); } bufferedReader.close(); } }