Listcommand = new ArrayList (); command.add("ping"); ProcessBuilder processBuilder = new ProcessBuilder(command); Process process = processBuilder.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "gbk")); StringBuffer stringBuffer = new StringBuffer(); String line = null; while((line = reader.readLine())!=null){ stringBuffer.append(line); stringBuffer.append("\n"); } System.out.println(stringBuffer.toString()); reader.close();