private static void checkUIAvailable() {

        String checkUIStr = System.getProperty(CHECK_UI);
        //if not in nogui mode check for a visible window
        if (Boot.isHeadless() == false && (checkUIStr == null || checkUIStr.equals("true"))) {

            //We need to check for a UI. Create a Timer to Check for the UI in 30 seconds
            java.util.Timer timer = new java.util.Timer(true);
            timer.schedule(new TimerTask() {
                public void run() {
                    try {
                        BootSecurityManager sm = (BootSecurityManager) System.getSecurityManager();
                        //no security manager so we don't need to test
                        if (sm == null) return;

                        if (sm.getExitClass() == null) sm.setExitClass(Boot.class);
                        if (!sm.checkWindowVisible()) {
                            String msg = Resources.bundle.getString("boot.no.user.interface");
                            msg = MessageFormat.format(msg, Boot.getAppDisplayName());
                            Boot.shutdownError(msg, null);
                        } else {
                            logger.info("Visible User Interface Detected!");
                        }
                    } catch (ClassCastException badCast) {
                        //Not using Our security manager can't check for UI
                        logger.info("Not using BootSecurityManager. Can't check for User Interface");
                    }
                }
            }, 30000); //30 seconds

        } else {
            logger.info("HEADLESS MODE: Not Checking for Visible User Interface.");
        }
    }