void launchClass(final Class klass)
	{
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			prefs.put("defaultClass", klass.getName());
			try {
				System.out.println(klass);
				System.err.println(klass);
				Method[] meths = klass.getMethods();
				for (int i=0; ; ++i) {
					if (i == meths.length) throw new Exception(
						"No main() method found in " + klass);
					if ("main".equals(meths[i].getName())) {
						setVisible(false);
						Object[] args = new Object[] {
							new String[]{}
						};
						meths[i].invoke(null, args);
						break;
					}
				}
			} catch(Exception e) {
				Throwable t = e;
				Throwable cause = t.getCause();
				while (cause != null) {
					t = cause;
					cause = t.getCause();
				}
//				Throwable cause = e.getCause();0
//				//e.printStackTrace(System.out);
//				if (cause == null) e.printStackTrace();
//				else cause.printStackTrace(System.err);
				t.printStackTrace();
				System.exit(-1);
			}
			System.out.println("====== Done running " + klass);
			
			boolean exit = 
				!(java.awt.Component.class.isAssignableFrom(klass));
			try {
				Field f = klass.getField("exitAfterMain");
				exit = f.getBoolean(null);
			} catch(Exception e) {
//				e.printStackTrace();
			}
			
			if (exit) System.exit(-1);
			else System.out.println("AppLauncher not exiting... ");
		}});
	}