Search in sources :

Example 1 with PortBindingException

use of org.languagetool.server.PortBindingException in project languagetool by languagetool-org.

the class Main method maybeStartServer.

private boolean maybeStartServer() {
    Configuration config = ltSupport.getConfig();
    if (config.getRunServer()) {
        try {
            HTTPServerConfig serverConfig = new HTTPServerConfig(config.getServerPort(), false);
            httpServer = new HTTPServer(serverConfig, true);
            httpServer.run();
            if (enableHttpServerItem != null) {
                enableHttpServerItem.setState(httpServer.isRunning());
                setTrayIcon();
            }
        } catch (PortBindingException e) {
            JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
    return httpServer != null && httpServer.isRunning();
}
Also used : HTTPServer(org.languagetool.server.HTTPServer) HTTPServerConfig(org.languagetool.server.HTTPServerConfig) PortBindingException(org.languagetool.server.PortBindingException)

Aggregations

HTTPServer (org.languagetool.server.HTTPServer)1 HTTPServerConfig (org.languagetool.server.HTTPServerConfig)1 PortBindingException (org.languagetool.server.PortBindingException)1