title: How to use Service --status-all | grep running in java code to get resullt my code not giving result?
body: <p>hi i am trying to get result of linux running service i am trying to use this code,</p>
  
  <pre><code>    public void runningservices()
  {
  
      try {
          String line;
          char c = '|';
          Process p = Runtime.getRuntime().exec("service --status-all "+c+" grep running");
          BufferedReader input =
                  new BufferedReader(new InputStreamReader(p.getInputStream()));
          while ((line = input.readLine()) != null)
          {
  String[] split = line.trim().split(" ");
              System.out.println(line);  
          }
          input.close();
      } catch (Exception err) {
          err.printStackTrace();
      }
  
  }
  </code></pre>
  
  <p>i tried this code but output is empty no error how to get running this code ?? this command is running on linux terminal and giving result </p>
  
  <p>hopes for your suggestiong thanks in advance !</p>