I\'m trying to creating a test class to open a JFrame. In order to stop the window from closing the moment the main thread finishes I added the code to open up the window in ano
the problem occurs when you try to set a Thread to Daemon(true). When you exit your application the thread cannot be stopped and hence throws an java.lang.IllegalStateException: Shutdown in progress
when you came over this problem you have to explicitly tell the Runtime to close the thread anyway, by adding a shotdownhook.
public void createIntegerClass() throws Exception {
Thread t = new Thread("Test Thread") {...};
Runtime.getRuntime().addShutdownHook(t);//explicit!
t.start();
t.setDaemon(true);
}