import javax.swing.JOptionPane; public class Test { public Test() { JOptionPane.showMessageDialog(null, "This will never close."); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.exit(0); Runtime.getRuntime().exit(0); } public static void main(String[] args) { new Test(); } }