Does a JVM exit when a stack overflow exception occurs in one of the executing threads?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try it for yourself using, for example with the following code (a new thread is spawned and started and calls
a()which calls itself recursively as to trigger a stack overflow while another thread prints something to the console):You’ll see your stack overflow error:
Exception in thread "Thread-1" java.lang.StackOverflowErrorand you’ll also see that the printing thread keeps happily printing along.
Also note that if the EDT thread dies, it is relaunched automagically.