title: Java. System.exit(int status). Value for exit status
body: <p>I saw a big amount of questions about <code>System.exit(int status)</code> on <code>stackoverflow</code>.</p>
  
  <p>For example:</p>
  
  <p><a href="https://stackoverflow.com/questions/2434592/difference-in-system-exit0-system-exit-1-system-exit1-in-java">Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6937660/difference-between-system-exit0-and-system-exit-1?rq=1">difference between System.exit(0) and System.exit(-1)</a></p>
  
  <p>But I do not see answer on my partial question:</p>
  
  <p>Do we have any direct connection between <code>exit status</code> and <code>System Error Codes</code> for Microsoft products(<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx" rel="nofollow noreferrer">Microsoft site</a>)?</p>
  
  <p>Sure, we do not have any direct connections, <strong>but:</strong> can we make this connection?</p>
  
  <p>If we run our java program on Windows OS and our java program has <code>System.exit(int status)</code> statement, can we use <code>System Error Codes list</code> or no? </p>
  
  <p>Is it good idea or not? </p>
  
  <p>What do you think about it? Any other ideas?</p>
  
  <p><strong>Example:</strong> </p>
  
  <ul>
  <li>Java program was run via command line on Wisdows OS;</li>
  <li>Our java program catched exception like <code>FileNotFoundException</code>;</li>
  <li>After this we made decision to close our program via <code>System.exit(int state)</code>;</li>
  <li>In this case can <code>exit status</code> be equal <strong>2</strong>? </li>
  </ul>
  
  <p>because(<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx" rel="nofollow noreferrer">Microsoft site</a>):</p>
  
  <pre><code>ERROR_FILE_NOT_FOUND
  2 (0x2)
  The system cannot find the file specified. 
  </code></pre>