title: Java starting another Java Application
body: <p>I am in the process of building a wrapper jar for a jar that I built. It will handle updating the main application and making sure users are valid users. I am having a major issue though, because I can't get the external jar launching function working. This is what I have so far:</p>
  
  <pre><code>ProcessBuilder builder = new ProcessBuilder("java -jar ~/Documents.Java/myJar.jar");
  try {
      Process process = builder.start();
  } catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>However, I am just getting a file not found exception.</p>
  
  <pre><code>java.io.IOException: Cannot run program "java -jar ~/Documents/Java/myJar.jar": error=2, No such file or directory
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
  at com.mycompany.DHSLauncher.Launcher.lambda$4(Launcher.java:109)
  at java.util.Optional.ifPresent(Optional.java:159)
  at com.mycompany.DHSLauncher.Launcher.showLogin(Launcher.java:102)
  at com.mycompany.DHSLauncher.Launcher.start(Launcher.java:35)
  at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
  at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
  at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
  at java.security.AccessController.doPrivileged(Native Method)
  at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
  at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
  
  Caused by: java.io.IOException: error=2, No such file or directory
  at java.lang.UNIXProcess.forkAndExec(Native Method)
  at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:248)
  at java.lang.ProcessImpl.start(ProcessImpl.java:134)
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
  ... 10 more
  </code></pre>
  
  <p>If I copy <code>java -jar ~/Documents.Java/myJar.jar</code> and paste it right into terminal, it works and the jar launches. I have no idea what is going on here. Is the path supposed to be relative to the location of the running jar?</p>