import org.mortbay.jetty.Connector; import org.mortbay.jetty.Server; import org.mortbay.jetty.handler.ContextHandlerCollection; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.jetty.webapp.WebAppContext; public class JettyRunner { public static void main(String[] args) throws Exception { SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(8080); Server server = new Server(); server.setConnectors(new Connector[] { connector }); WebAppContext context = new WebAppContext(); context.setContextPath("/sample"); context.setWar("src/main/webapp"); server.addHandler(context); server.start(); server.join(); } }