From an unpacked release directory of jetty-7, the server can be started with the command:
This will start a HTTP server on port 8080 and deploy the test web application at:
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:
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:
etc directory has many such extra configuration file examples.
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:
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:
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:
To run with JSP suppport:
Deploying web applications
Web applications may be deployed by either:
- directly configuring them in the jetty.xml or other configuration file
- placing the war in the
webappsdirectory where it is discovered by the WebAppDeployer
- placing a desciptor in the
contextsdirectory where it is discovered by the ContextDeployer
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.
Use ctrl-C to stop the server.