title: Using java to get the current process owner
body: <p>I want to know the owner of current process in Unix using Java. I want to find the current server's owner name. I tried with running "who am i" command in Runtime.getRuntime().exec(), but its not returning me any results.</p>
  
  <pre><code>String line = ""; 
  Process p = Runtime.getRuntime().exec("who am i");
  InputStream iStream = p.getInputStream();
  InputStreamReader inputStreamReader = new InputStreamReader(iStream);
  BufferedReader bufReader = new BufferedReader(inputStreamReader);
  while ((line = bufReader.readLine()) != null) {
      System.out.println("Input "+line);
  }
  </code></pre>
  
  <p>Is there anything wrong with this code or any idea how can I find the owner of current process using Java?</p>