capture error from runtime process java
问题 I'm running a Java program from another Java application using Runtime.getRuntime().exec like this Process p1 = Runtime.getRuntime().exec("javac test.java"); Process p2 = Runtime.getRuntime().exec("java test"); The content of the test.java import java.io.*; class test { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); System.out.println(s); } } I want to handle Input , Output and Error stream of the process p2 . I did capture of the