I saw a big amount of questions about System.exit(int status)
on stackoverflow
.
For example:
Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java
difference between System.exit(0) and System.exit(-1)
But I do not see answer on my partial question:
Do we have any direct connection between exit status
and System Error Codes
for Microsoft products(Microsoft site)?
Sure, we do not have any direct connections, but: can we make this connection?
If we run our java program on Windows OS and our java program has System.exit(int status)
statement, can we use System Error Codes list
or no?
Is it good idea or not?
What do you think about it? Any other ideas?
Example:
- Java program was run via command line on Wisdows OS;
- Our java program catched exception like
FileNotFoundException
; - After this we made decision to close our program via
System.exit(int state)
; - In this case can
exit status
be equal 2?
because(Microsoft site):
ERROR_FILE_NOT_FOUND
2 (0x2)
The system cannot find the file specified.