title: How to exit the windows command prompt in which a java application got started
body: <p>How to exit the console of a simple Java program after displaying an error message?</p>
  
  <p>currently my code has:</p>
  
  <pre><code>...
  ...
  if (some condition){
  //print error
  System.exit();
  ...
  ...
  </code></pre>
  
  <p>But this <code>System.exit();</code> leaves the console open. I have tried <code>exit(0);</code>, <code>System.exit(0);</code> as well.</p>