title: Using Java ProcessBuilder, how do I run a process located in a unix home directory?
body: <p>We have a Java server-client application that allows us to run processes on different boxes (i.e. the clients), which are started by the Java <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html" rel="nofollow noreferrer"><code>ProcessBuilder</code></a>. I want to run a process that will be copied/synced to the user's home directory (i.e. the user who started the client).</p>
  <p>How do I reference the unix home directory in the <code>String</code> that is passed to the <code>ProcessBuilder</code>? (Due to the design of the server-client application, only a String of the process, args etc. is passed to the ProcessBuilder.)</p>
  <p>It works if I state the home directory explicitly:</p>
  <ul>
  <li><code>/home/user/processes/process.sh</code></li>
  </ul>
  <p>However, that assumes that I know which user is running the client. (Part of the design is that we can switch/substitute boxes/clients to run jobs, without necessarily knowing who started the client on a given box.)</p>
  <p>I've also tried, but to no avail:</p>
  <ul>
  <li><code>$HOME/processes/process.sh</code></li>
  <li><code>~/processes/process.sh</code></li>
  </ul>