命令行java应用程序中未处理的异常在哪里打印出来?到stdout或stderr? [英] Where are unhandled exceptions in command line java application printed out by default? To stdout or stderr?

查看:94
本文介绍了命令行java应用程序中未处理的异常在哪里打印出来?到stdout或stderr?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题包含整个问题。我也会感谢链接到持有答案的文件。

The title contains the entire question. I would be also grateful for a link to documentation holding an answer.

推荐答案

在Java中,未处理的异常计算到线程的顶端在那里他们被抛出。 Java允许您安装线程级别未捕获异常处理程序。据我所知,当没有指定默认异常处理程序时,行为没有被Java规范定义。 Sun的JDK观察到的默认行为是将异常消息及其堆栈跟踪打印到stderr。

In Java unhandled exceptions perculate to the top of the thread in which they were thrown. Java allows you to install a thread-level uncaught exception handler. The behavior when there is no default exception handler specified, as far as I know, is not defined by the Java specification. Sun's JDK observed default behavior is to print the exception message and its stack trace to stderr.

这篇关于命令行java应用程序中未处理的异常在哪里打印出来?到stdout或stderr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆