Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a complete List of JVM exit codes

Tags:

jvm

exit-code

I am looking for a complete list of all possible jvm exit codes (not java System.exit(x)). The only thing I could find by using a search engine is a list of SIGTERM exit codes: http://journal.thobe.org/2013/02/jvms-and-kill-signals.html . I want to know if there are specific exit codes for uncatched Exceptions?

like image 466
KIC Avatar asked Jul 16 '13 08:07

KIC


People also ask

How do I exit JVM?

The JVM is interrupted (by using ctrl C or sending SIGINT). The JVM is terminated (by sending SIGTERM) One of the threads calls System. exit() or Runtime.

What can I use instead of system exit in Java?

The main alternative is Runtime. getRuntime(). halt(0) , described as "Forcibly terminates the currently running Java virtual machine". This does not call shutdown hooks or exit finalizers, it just exits.

What is the difference between system exit 0 and system exit 1 in Java?

exit(0) : Generally used to indicate successful termination. exit(1) or exit(-1) or any other non-zero value – Generally indicates unsuccessful termination. Note : This method does not return any value.


1 Answers

Argument passed to System.exit(x) -> becomes the JVM exit code.

Exit code 0 is used to indicate normal exit. Unique positive exit code to indicate specific problem.

I want to know if there are specific exit codes for uncatched Exceptions?

No. If all non-daemon threads exit normally(presence/absence of exception does not matter), JVM terminates with 0.

Exit code between 1 and 127 are specific codes used to indicate error in JVM. e.g. mismatched jdk/jre versions, incorrect memory configuration/command-line options, etc.

About the link

http://journal.thobe.org/2013/02/jvms-and-kill-signals.html

JVM exit due to specific signal would be

128+signal-id

List of signal-id can be found using kill -l

like image 164
Amit G Avatar answered Sep 20 '22 11:09

Amit G