title: Can't run the jetty server
body: <p>I'm currently learning jetty. I copied some code from Jetty tutorial to embed jetty into java code.
  Below is the code I use(copied from <a href="http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html" rel="nofollow">http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html</a>):
      package org.eclipse.jetty.embedded;</p>
  
  <pre><code>import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.eclipse.jetty.server.Server;
  import org.eclipse.jetty.servlet.ServletHandler;
  
  public class MinimalServlets {
  
  public static void main(String[] args) throws Exception {
      Server server = new Server(8080);
      ServletHandler handler = new ServletHandler();
      server.setHandler(handler);
      handler.addServletWithMapping(HelloServlet.class, "/*");
      server.start();
      server.join();
  }
  
  @SuppressWarnings("serial")
  public static class HelloServlet extends HttpServlet {
  
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          response.setContentType("text/html");
          response.setStatus(HttpServletResponse.SC_OK);
          response.getWriter().println("&lt;h1&gt;Hello SimpleServlet&lt;/h1&gt;");
      }
  }
  
  }
  </code></pre>
  
  <p>When I try to run this server in eclipse, it terminates immediately after I start it, but I thought it should keep running and listening for requests.</p>
  
  <p>The external libraries I used are:</p>
  
  <p>jetty-all-9.1.3.v20140225.jar,<br>
  javax.servlet.jar</p>
  
  <p>The eclipse console log is as below:</p>
  
  <p>2014-04-12 11:03:57.700:INFO::main: Logging initialized @189ms
  9.1.3.v20140225</p>
  
  <p>What is the problem here?
  Thanks a lot.</p>