开发者

Runtime exception not terminating the programm [closed]

Closed. This question needs debugging details. It is not currently accepting answers. 开发者_运维技巧

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 question

As 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜