Posted on Leave a comment


Jetty home

  • Standalone server
    There is no installation procedure for Jetty. Just unzip.

    java -jar start.jar

    If success

    INFO:oejs.Server:main: Started @11245ms

    By default, Jetty runs on port 8080. To change port open start.ini and change the line

    ## Connector port to listen on

    and restart Jetty.
    To deploy a app copy *.war file to webapps folder and open page by


    To change WebApps folder you need to edit start.ini file

    # Monitored directory name (relative to $jetty.base)
    # jetty.deploy.monitoredDir=webapps
  • Embedded server
    • Maven dependencies
    • Develop app

      import org.eclipse.jetty.server.*;
      import org.eclipse.jetty.servlet.*;
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import org.eclipse.jetty.http.HttpStatus;
      public class jmain {
      	public static void Main(String[] args) {
      		Server sever = new Server(7077);
      		ServletContextHandler handler = new ServletContextHandler(sever, "/example");
      		handler.addServlet(ExampleServlet.class, "/");
      	public class ExampleServlet extends HttpServlet {
      		protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
      				throws ServletException, IOException {
Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.