import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Date; public class JavaShell { public static void main(String[] args) { System.out.println("JavaShell V01 by Keyholder"); System.out.println("Date:" + new Date(System.currentTimeMillis())); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cmd = ""; while (cmd != null) { System.out.print("\n$> "); try { cmd = in.readLine(); } catch (IOException e1) { e1.printStackTrace(); } Method method = null; try { method = JavaShell.class.getMethod(cmd, new Class[] {}); method.invoke(JavaShell.class, new Object[] {}); } catch (NoSuchMethodException e) { System.out.println("Command not found"); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } public static void exit() { System.out.println("Bye bye"); System.exit(0); } }