title: How to run a .jar file from a java program
body: <p>Ok, I figured out how to run a .exe from this program, but I don't know how to run a .jar.</p>
  
  <pre><code>package com.Kaelinator;
  
  import java.io.IOException;
  
  public class ServerManager {
      public static void main(String[] args){
  
          try {
              System.out.println("Opening");
              Runtime runTime = Runtime.getRuntime();
              Process process = runTime.exec("D:/Program Files/Sony/Vegas Pro 12.0/vegas");
              try {
                  Thread.sleep(10000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              System.out.println("Closing");
              process.destroy();
          } catch (IOException e){
              e.printStackTrace();
             }
          }
      }
  </code></pre>
  
  <p>That will run Sony Vegas Pro, wait 10 seconds, and then close it.
  Here's what I have so far, trying to get to run a .jar:</p>
  
  <pre><code>package com.Kaelinator;
  
  import java.io.IOException;
  
  public class ServerManager {
      public static void main(String[] args){
  
          try {
              System.out.println("Opening");
              Runtime runTime = Runtime.getRuntime();
              Process process = runTime.exec(" java -jar " + "C:/Users/Owner/Desktop/minecraft_server.15w51b");
              try {
                  Thread.sleep(10000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              System.out.println("Closing");
              process.destroy();
          } catch (IOException e){
              e.printStackTrace();
          }
          }
      }
  </code></pre>
  
  <p>No error about not finding the file, nor any error at all. The program runs like it would, just without opening anything.</p>
  
  <p>Please help!</p>