@Override public void init(ServletConfig config) throws ServletException { super.init(config); System.setProperty("kotlin.running.in.server.mode", "true"); System.setProperty("java.awt.headless", "true"); ApplicationSettings.WEBAPP_ROOT_DIRECTORY = getServletContext().getRealPath("/"); ApplicationSettings.EXAMPLES_DIRECTORY = ApplicationSettings.WEBAPP_ROOT_DIRECTORY + "examples"; CommonSettings.HELP_DIRECTORY = ApplicationSettings.WEBAPP_ROOT_DIRECTORY; if (!loadTomcatParameters()) { ErrorWriter.writeErrorToConsole( "FATAL ERROR: Cannot load parameters from tomcat config, server didn't start"); System.exit(1); } ErrorWriter.ERROR_WRITER = ErrorWriter.getInstance(); // Initializer.INITIALIZER = ServerInitializer.getInstance(); try { ErrorWriter.writeInfoToConsole("Use \"help\" to look at all options"); new File(CommonSettings.LOGS_DIRECTORY).mkdirs(); LogWriter.init(); ExamplesLoader.loadAllExamples(); HelpLoader.getInstance(); MySqlConnector.getInstance(); } catch (Throwable e) { ErrorWriter.writeExceptionToConsole( "FATAL ERROR: Initialisation of java core environment failed, server didn't start", e); System.exit(1); } }
private boolean isWindows() { return (System.getProperty("os.name").toLowerCase().contains("win")); }