I used java to execute bash script to count total of the process. But, the result I got is empty in input BufferedReader.
public static void main(String[] args) {
try {
Process process = Runtime.getRuntime().exec("ps aux | wc -l");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while ((line = stdInput.readLine()) != null) {
System.out.println(line);
}
} catch (Exception ex) {
Logger.error(TAG, ex);
}
but when I execute "ps aux | wc -l" in terminal it return "250". Can anyone help me. Thanks so much.