UncaughtExceptionHandlerを実装しましょう。
`
import java.lang.Thread.UncaughtExceptionHandler;
public class ThreadException {
public static void main(String[] args) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
throw new RuntimeException("例外発生");
}
});
t.setUncaughtExceptionHandler(new ExceptionHandler());
t.start();
}
}
class ExceptionHandler implements UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread t, Throwable e) {
e.printStackTrace();
}
}
`
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2014/08/07 05:32