Jetty Logo
Version: 9.2.9-SNAPSHOT
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Running Jetty

Demo Base
Creating a new Jetty Base
Changing the Jetty Port
Starting HTTPS
More start.jar options

To start Jetty on the default port of 8080, run the following command:

> cd $HOME/jetty-distribution-9
> java -jar start.jar
2013-09-06 13:52:43.326:INFO:oejs.Server:main: jetty-9-demo
2013-09-06 13:52:43.358:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/home/user/jetty-distribution-9/webapps/] at interval 1
2013-09-06 13:52:43.390:INFO:oejs.ServerConnector:main: Started ServerConnector@2edf362d{HTTP/1.1}{}

You can point a browser at this server at http://localhost:8080.

Demo Base

Since release 9.1, the jetty distribution does not deploy any demo web applications, so to see a more interesting demonstration of the server you need to run from the demo-base directory as follows:

> cd $HOME/jetty-distribution-9/demo-base/
> java -jar ../start.jar
2013-09-06 13:56:35.939:WARN::main: demo test-realm is deployed. DO NOT USE IN PRODUCTION!
2013-09-06 13:56:35.943:INFO:oejs.Server:main: jetty-9-demo
2013-09-06 13:56:35.976:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/home/user/jetty-distribution-9/demo-base/webapps/] at interval 1
2013-09-06 13:56:36.240:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
2013-09-06 13:56:36.732:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
2013-09-06 13:56:38.572:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@2757052e{/,file:/home/user/jetty-distribution-9/demo-base/webapps/ROOT/,AVAILABLE}{/ROOT}
2013-09-06 13:56:38.579:INFO:oejs.ServerConnector:main: Started ServerConnector@19e0cb78{HTTP/1.1}{}

Pointing a browser at http://localhost:8080, will now show a welcome page and several demo/test web applications.


The demonstration web applications are not necessarily secure and should not be deployed in production web servers.

Creating a new Jetty Base

The demo-base directory described above is an example of the jetty.base mechanism added in Jetty 9.1. A jetty base allows the configuration and web applications of a server instance to be stored separately from the jetty distribution, so that upgrades can be done with minimal disruption. Jetty's default configuration is based on two properties:


The property that defines the location of the jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc)


The property that defines the location of a specific instance of a jetty server, its configuration, logs and web applications (typically start.ini, start.d, logs and webapps)

The jetty.home and jetty.base properties may be explicitly set on the command line, or they can be inferred from the environment if used with commands like:

> cd $HOME/my-base
> java -jar $HOME/jetty-distribution-9/start.jar

The following commands create a new base directory and enable a HTTP connector and web application deployer in it:

> mkdir /tmp/mybase
> cd /tmp/mybase
> java -jar $HOME/jetty-distribution-9/start.jar
WARNING: Nothing to start, exiting ...

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information

> java -jar $HOME/jetty-distribution-9/start.jar --add-to-startd=http,deploy
http            initialised in ${jetty.base}/start.d/http.ini (created)
server          initialised in ${jetty.base}/start.d/server.ini (created)
deploy          initialised in ${jetty.base}/start.d/deploy.ini (created)
MKDIR: ${jetty.base}/webapps
server          initialised in ${jetty.base}/start.d/server.ini

> java -jar $HOME/jetty-distribution-9/start.jar
2013-09-06 14:59:32.542:INFO:oejs.Server:main: jetty-9-demo
2013-09-06 14:59:32.572:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/tmp/mybase/webapps/] at interval 1
2013-09-06 14:59:32.602:INFO:oejs.ServerConnector:main: Started ServerConnector@405a2273{HTTP/1.1}{}


Changing the Jetty Port

You can configure Jetty to run on a different port by setting the jetty.port Property on the command line:

> cd $HOME/jetty-distribution-9/demo-base
> java -jar ../start.jar jetty.port=8081

Alternatively, property values can be added to the effective command line built from the start.ini file and start.d/*.ini files. By default, the jetty distribution defines the jetty.port property in the start.d/http.ini file, which may be edited to set another value.


The configuration by properties works via the following chain:

  • The start.d/http.ini file is part of the effective command line and contains the --module=http argument which activates the http module

  • The modules/http.mod file defines the http module which specifies the etc/jetty-http.xml configuration file and the template ini properties it uses.

  • The jetty.port property is used by the Property XML element in etc/jetty.http.xml to inject the ServerConnector instance with the port

For more information see the Quickstart Configuration Guide and Configuring Connectors.

Starting HTTPS

To add the HTTPS connector to a jetty configuration, the https module can be activated by the following command:

> java -jar start.jar --add-to-startd=https
https           initialised in ${jetty.home}/start.d/https.ini (created)
ssl             initialised in ${jetty.home}/start.d/ssl.ini (created)
server          enabled in     ${jetty.home}/start.ini
resources       enabled in     ${jetty.home}/start.ini
ext             enabled in     ${jetty.home}/start.ini

> java -jar start.jar
2013-09-06 13:52:43.326:INFO:oejs.Server:main: jetty-9...

The --add-to-startd command sets up the effective command line in the ini files to run a https connection as follows:

  • creates the start.d/https.ini file that activates and configures the https connector module. The https module adds the etc/jetty-https.xml file to the effective command line.

  • creates the start.d/ssl.ini file that activates and configures the SSL keystore using demonstration passwords. The ssl module adds the etc/jetty-ssl.xml file to the effective command line.

  • checks for the existence of a etc/keystore file and if not present, downloads a demonstration keystore file.


If a single start.ini file is preferred over individual start.d/*.ini files, then the option --add-to-start=module may be used to append the module activation to the start.ini file rather than create a file in start.d

Changing the Jetty HTTPS Port

You can configure the SSL connector to run on a different port by setting the https.port property on the command line:

> cd $HOME/jetty-distribution-9/demo-base
> java -jar ../start.jar https.port=8444

Alternatively, property values can be added to the effective command line built from the start.ini file and start.d/*.ini files. If you used the --add-to-startd command to enable https, then you can edit this property in the start.d/https.ini file. If you used --add-to-start command, then you can edit this propery in the start.ini file.

More start.jar options

The job of the start.jar is to interpret the command line, start.ini and start.d to build a Java classpath and list of properties and configuration files to pass to the main class of the Jetty XML configuration mechanism. The start.jar mechanism has many options which are documented in the startup administration section and you can see them in summary by using the command:

> java -jar start.jar --help

See an error or something missing? Contribute to this documentation at Github!(Generated: 2015-03-28T01:00:53+00:00)