Running Jetty-7.0.x

From an unpacked release directory of jetty-7, the server can be started with the command:

java -jar start.jar

This will start a HTTP server on port 8080 and deploy the test web application at:

http://localhost:8080/test

Configuration

The default configuration of jetty is in the etc/jetty.xml file (see Syntax Reference), which configures the HTTP connectors, web application deployers and other server components (see Configuring Jetty). The configuration file may be directly invoked with:

java -jar start.jar etc/jetty.xml

Jetty Configuration files are additive and multiple can be specified on the command line to activate and configure additional features. For example, to add an SSL listener to jetty:

java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml

The etc directory has many such extra configuration file examples.

Options

The start.jar command is responsible for creating the java classpath and executing the server with your configuration. By default, some options are not placed on the classpath and the -DOPTION parameter is needed to add additional libraries to the classpath. To see the options available use the command:

java -jar start.jar --version

Once one option is specified, the default options are no longer added and all options used must be listed. For example to run jetty with jmx:

java -DOPTIONS=server,security,servlet,xml,webapp,deploy,jmx -jar start.jar etc/jetty-jmx.xml etc/jetty.xml

For simplicity, the option Server is defined to mean the server option and all it's common dependencies and associates. So the above jmx example can be simplified to:

java -DOPTIONS=Server,deploy,jmx -jar start.jar etc/jetty-jmx.xml etc/jetty.xml

To run with JSP suppport:

java -DOPTIONS=Server,deploy,jsp -jar start.jar  etc/jetty.xml

Deploying web applications

Web applications may be deployed by either:

The default jetty.xml file configures both a webapp and a contexts deployer, so it is usually sufficient just to drop your WAR file into the webapps directory before starting the server.

Stopping

Use ctrl-C to stop the server.