Q:

Runtime Exception from a thread in Thread Pool completely disappears: how to handle

Friends see this simple code below. Note that I am using a thread pool, and thus I have no direct access to threads from my code.  In this code, there should be a NPE, but it completely disappears, and the code exits silently. I understand maybe exception stack is not available in main thread, but how in the world can display the occurence of a runtime exception? I am not interested in putting a try - catch(Exception e) all  over the code since I cannot be sure where an NPE or runtime exception can occur. Runtime exceptions must be displayed before killing the JVM. But how? I have even put a try - catch(Exception) around main thread, but to no avail.
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

public class Test {

    ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(4);

    public static void main(String[] args) {
        new Test().execute();
    }

    void execute(){
        System.out.println("start");

        List<Callable<String>>li = new ArrayList<>();

        li.add(() -> {
            String s = null;
            s.toLowerCase();
            return "Hello";
        });

        try {
            List<Future<String>> cs = executor.invokeAll(li);
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("end");
        executor.shutdown();
    }
}

A:

Look at Thread.setDefaultUncaughtExceptionHandler
This will call your handler when there is an uncaught exception

