(String[] s)
| 14 | public class Run { |
| 15 | static public void main(String[] s) { |
| 16 | |
| 17 | LoggingDefaults.initialize(); |
| 18 | |
| 19 | if (Main.os == Main.OS.mac) Toolkit.getDefaultToolkit(); |
| 20 | |
| 21 | // TODO --- get from command line / previous |
| 22 | Options.parseCommandLine(s); |
| 23 | |
| 24 | PluginList pluginList; |
| 25 | try { |
| 26 | pluginList = new PluginList(); |
| 27 | Map<String, List<Object>> plugins = pluginList.read(System.getProperty("user.home") + "/.field/plugins.edn", true); |
| 28 | |
| 29 | if (plugins != null) pluginList.interpretClassPathAndOptions(plugins); |
| 30 | } catch (IOException e) { |
| 31 | e.printStackTrace(); |
| 32 | pluginList = null; |
| 33 | } |
| 34 | |
| 35 | String mainClass = Options.getString("main", () -> "-main NOT SPECIFIED"); |
| 36 | |
| 37 | try { |
| 38 | Class<?> c = Run.class.getClassLoader() |
| 39 | .loadClass(mainClass); |
| 40 | Object o = c.getConstructor() |
| 41 | .newInstance(); |
| 42 | if (o instanceof Runnable) ((Runnable) o).run(); |
| 43 | |
| 44 | } catch (ClassNotFoundException e) { |
| 45 | Log.log("startup.error", ()->"couldn't find class to run <" + mainClass + ">"); |
| 46 | e.printStackTrace(); |
| 47 | System.exit(1); |
| 48 | } catch (InvocationTargetException e) { |
| 49 | Log.log("startup.error", ()->"couldn't construct to run <" + mainClass + ">"); |
| 50 | e.printStackTrace(); |
| 51 | System.exit(1); |
| 52 | } catch (NoSuchMethodException e) { |
| 53 | Log.log("startup.error", ()->"couldn't construct to run <" + mainClass + ">"); |
| 54 | e.printStackTrace(); |
| 55 | System.exit(1); |
| 56 | } catch (InstantiationException e) { |
| 57 | Log.log("startup.error", ()->"couldn't construct to run <" + mainClass + ">"); |
| 58 | e.printStackTrace(); |
| 59 | System.exit(1); |
| 60 | } catch (IllegalAccessException e) { |
| 61 | Log.log("startup.error", ()->"couldn't construct to run <" + mainClass + ">"); |
| 62 | e.printStackTrace(); |
| 63 | System.exit(1); |
| 64 | } |
| 65 | |
| 66 | System.exit(0); |
| 67 | |
| 68 | } |
| 69 | } |
nothing calls this directly
no test coverage detected