try { String exeBat = "c:/test.bat"; Process child = Runtime.getRuntime().exec(exeBat); InputStream in = child.getInputStream(); BufferedReader br= new BufferedReader(new InputStreamReader(in)); String line = br.readLine().toString(); while(line!=null ){ System.out.println(line); //输出测试 line = br.readLine().toString(); } try{ child.waitFor(); br.close(); in.close(); }catch (Exception e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); }