title: Executable Jar file does not work when run from Java code
body: <p>I have run jar from cmd using
  <code>java -jar abc.jar</code> It produces out put correctly on the command prompt window.</p>
  
  <p>But when I try to run it from code, I am getting no out put, logs or exceptions;; and the program terminates.</p>
  
  <p>So far, I have tried the following:  In both cases, input stream is not null but also contains no data.</p>
  
  <pre><code>public static void main(String[] args) {
      Process proc = null;
      try {
          proc = Runtime.getRuntime().exec("java -jar path/to/abc.jar");
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      InputStream in =  proc.getInputStream();
  }     
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public static void main(String[] args) {
      ProcessBuilder pb = new ProcessBuilder("java", "-jar", "path/to/abc.jar");
      pb.directory(new File("C:\\"));
      try {
          Process proc = pb.start();
          proc.getInputStream();
      }
      catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  } 
  </code></pre>
  
  <p>Any help would be appreciated.</p>