Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this questionAs per my little-bit java knowledge Program supposed to be terminated after it throws runtime exception.
But in my application after throwing runtime exception it is not terminating ,and as i am executing it on linux i have to use ctrl+c to terminate it, Otherwise it just do not terminate.
I am creating jar on windows sytem and copy paste it in linux.
Also i have logging enabled in my application.
Update: I am not catching any exception No multithreading is used.
A RuntimeException
(or any Exception
or Throwable
) does not necessarily terminate your application.
It only terminates your applications if it's thrown on the only non-daemon thread and is not handled.
That means that if either another non-daemon thread is running or you catch the exception, the application will not be terminated.
This recent answer from me gives a summary of what happens (it's specifically about an OutOfMemoryError
, but the idea is the same).
精彩评论