I have a Spring application and have used Tomcat to develop it and run it on the server. I was quite frustrated with deploy->undeploy-->deploy again-->.. development process, so I decided to switch to embedded Jetty. So basically now I have just a single Java class that's responsible for starting my server:

```
public class MainServer {

private Server start() throws Exception {
    Server jetty = new Server();
    String[] configFiles = { "WebContent/WEB-INF/jetty.xml" };
    for (String configFile : configFiles) {
        XmlConfiguration configuration = new XmlConfiguration(new File(configFile).toURI().toURL());
        configuration.configure(jetty);
    }

    WebAppContext appContext = new WebAppContext();
    File warPath = new File("WebContent");
    appContext.setWar(warPath.getAbsolutePath());
    appContext.setClassLoader(Thread.currentThread().getContextClassLoader());
    appContext.setContextPath("/4d");
    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] { appContext, new DefaultHandler() });
    jetty.setHandler(handlers);

    jetty.start();
    jetty.join();
    return jetty;
}

public static void main(String[] args) {
    try {
        new MainServer().start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

}

```

This is perfect for developing as it allows hotswapping and seems to be faster. However, I would also like to deploy this setting to my server later on. What is the best way to start this server and running it in the background (like Tomcat startup.sh)? How should I call this MainServer class?