title: Double Clicking JAR file does not open Command Prompt
body: <p>I want to run a Jar file by double clicking it.</p>
  
  <p>Following is the only Java class file present in it.</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.io.IOException;
  public class Sysout{
  public static void main(String[] args) throws IOException{
      System.out.println("Hello World!");
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String msg = br.readLine();
      System.out.println(msg);
      br.read();
  }
  }
  </code></pre>
  
  <p>And Manifest file has Main-Class defined.</p>
  
  <p>Using <a href="https://stackoverflow.com/questions/2622062/batch-file-command-to-run-jar-file">this</a> link, I successfully ran the Jar file by double-clicking the batch file.
  This opens the command prompt and runs the main class defined.</p>
  
  <p>However, if I double click the Jar file directly, nothing happens.
  I also checked <a href="https://stackoverflow.com/questions/8511063/how-to-run-jar-file-by-double-click-on-windows-7-64">this</a> link and associated my .jar to javaw.exe
  <a href="https://stackoverflow.com/questions/5428079/could-not-find-the-main-class-when-double-clicking-jar-file">This</a> link also suggests the same.
  Also tried by associating the .jar with java.exe</p>
  
  <p>What happens is the command prompt opens for a fraction of second and vanishes off.</p>
  
  <p>Even if I am expecting the user to enter some data, double-clicking operation does not wait for the user to enter anything.</p>
  
  <p>Where is the problem?</p>