import javax.swing.JFrame;import java.lang.reflect.Method;import java.lang.reflect.InvocationTargetException;public class LFSwitcher { public static void main(String[] args) throws InvocationTargetException, IllegalAccessException { Object[] arr = new Object[args.length-1]; System.arraycopy(args, 1, arr, 0, arr.length); JFrame.setDefaultLookAndFeelDecorated(true); Class c = null; try { c = Class.forName(args[0]); } catch(ClassNotFoundException e) { System.err.println("ERROR: CLASS COULD NOT BE FOUND"); System.exit(1); } Method[] meth = c.getDeclaredMethods(); Method method = null; for(Method m : meth) { if(m.getName()=="main") { method = m; break; } } if(method==null) { System.err.println("ERROR: MAIN CLASS NOT FOUND"); System.exit(1); } method.invoke(c, arr); //Actually does the stuff. }}