public static void main(String[] args) { Scanner scanner = new Scanner(); CommandLine cmds; try { cmds = scanner.getCommands(args); } catch (ParseException e) { System.out.println("Could not parse command line arguments. Error:\n" + e.getStackTrace()); return; } String modPath = null; if ((modPath = cmds.getOptionValue("i")) == null) { System.out.println("Need to provide a path to the Minecraft mod .jar"); return; } String libPath = null; if ((libPath = cmds.getOptionValue("l")) == null) { System.out.println("Need to provide a path to the Minecraft install directory"); return; } File modFile = new File(modPath); if (!modFile.exists() || modFile.isDirectory()) { System.out.println("Could not find mod at provided path"); return; } if (!checkHasExtension(modFile, ".jar")) { System.out.println("File does not have .jar extension"); return; } // /home/michael/.minecraft/mods/test-1.0.jar List<String> classNames = scanner.getClassNames(modFile); System.out.println("Class names:"); for (String name : classNames) { System.out.println(name); } System.out.println("Executing methods with no arguments"); for (String name : classNames) { System.out.println( "Executing class: " + name + "\n------------------------------------------------------------------------------------"); scanner.executeClassMethods(modFile, name, libPath); } boolean timeout; try { timeout = scanner.executor.awaitTermination(10, TimeUnit.SECONDS); if (timeout) { System.out.println("Executor did no timeout"); } else { System.out.println("Executor did timeout"); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.exit(0); }