Hello i try to get Input in java from this command: "ps aux | grep java" I use this code but not work:
Process process = Runtime.getRuntime().exec("ps aux | grep java");
InputStream stdin = process.getInputStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = null;
System.out.println("<OUTPUT>");
while ((line = br.readLine()) != null) {
System.out.println(line);
}
System.out.println("</OUTPUT>");
int exitVal = process.waitFor();
System.out.println("Process exitValue: " + exitVal);
output in console: Process exitValue: 1 Any ideas?