Jetty Logo
Version: 9.2.2-SNAPSHOT
Contact the core Jetty developers at www.webtide.com

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

Using start.jar

start.jar Command Line Options

The most basic way of starting the Jetty standalone server is to execute the start.jar, which is a bootstrap for starting Jetty with the configuration you want.

[jetty-distribution-9.2.2-SNAPSHOT]$ java -jar start.jar
2013-09-23 11:27:06.654:INFO:oejs.Server:jetty-${project.version}
...

Jetty is a highly modularized web server container. Very little is mandatory and required, and most components are optional; you enable or disable them according to the needs of your environment.

At its most basic, you configure Jetty from two elements:

  1. A set of libraries and directories that make up the server classpath.

  2. A set of Jetty XML configuration files (IoC style) that establish how to build the Jetty server and its components.

Starting with Jetty 9.1 you have more options on how to configure Jetty (these are merely syntactic sugar that eventually resolve into the two basic configuration components).

Jetty 9.1 Startup Features include:

These are powerful new features, made to support a variety of styles of configuring Jetty, from a simple property based configuration, to handling multiple installations on a server, to customized stacks of technology on top of Jetty, and even the classic, custom XML configurations of old.

For example, if you use the ${jetty.base} concepts properly, you can upgrade the Jetty distribution without having to remake your entire tree of modifications to Jetty. Simply separate out your specific modifications to the ${jetty.base}, and in the future, just upgrade your ${jetty.home} directory with a new Jetty distribution.

Executing start.jar

When you execute start.jar the system:

start.jar Command Line Options

Basic command line options:

--help

Obtains the current list of command line options and some basic usage help.

--version

Shows the list of server classpath entries, and prints version information found for each entry.

--list-classpath

Similar to --version, shows the server classpath.

--list-config

Lists the resolved configuration that will start Jetty.

Output includes:

  • Java environment

  • Jetty environment

  • JVM arguments

  • Properties

  • Server classpath

  • Server XML configuration files

--dry-run

Prints the resolved command line that start.jar should use to start a forked instance of Jetty.

--exec

Starts a forked instance of Jetty.

Debug and Start Logging Options:

--debug

Enables debugging output of the startup procedure.

Note: This does not set up debug logging for Jetty itself.

--start-log-file=<filename>

Sends all startup output to the filename specified.

Filename is relative to ${jetty.base}.

This is useful for capturing startup issues where the Jetty-specific logger has not yet kicked in due to a possible startup configuration error.

Module Management:

--list-modules

Lists all the modules defined by the system.

Looks for module files using the normal ${jetty.base} and ${jetty.home} resolution logic.

Also lists enabled state based on information present on the command line, and all active startup INI files.

--module=<name>,(<name>)*

Enables one or more modules by name (use --list-modules to see the list of available modules).

This enables all transitive (dependent) modules from the module system as well.

If you use this from the shell command line, it is considered a temporary effect, useful for testing out a scenario. If you want this module to always be enabled, add this command to your ${jetty.base}/start.ini.

--add-to-start=<name>,(<name>)*

Enables a module by appending lines to the ${jetty.base}/start.ini file.

The lines that are added are provided by the module-defined INI templates.

Note: Transitive modules are also appended.

--add-to-startd=<name>,(<name>)*

Enables a module via creation of a module-specific INI file in the ${jetty.base}/start.d/ directory.

The content of the new INI is provided by the module-defined ini templates.

Note: Transitive modules are also created in the same directory as their own INI files.

--write-module-graph=<filename>

Advanced feature: Creates a graphviz dot file of the module graph as it exists for the active ${jetty.base}.

# generate module.dot
$ java -jar start.jar --module=websocket --write-module-graph=modules.dot

# post process to a PNG file
$ dot -Tpng -o modules.png modules.dot

See graphviz.org for details on how to post-process this dotty file into the output best suited for your needs.

Command Line Stop Option:

--stop

Sends a stop signal to the running Jetty instance.

Note: The server must have been started with various stop properties for this to work.

Properties:

STOP.PORT=<number>

The port to use to stop the running Jetty server. This is an internal port, opened on localhost, used solely for stopping the running Jetty server. Choose a port that you do not use to serve web traffic.

Required for --stop to function.

STOP.KEY=<alphanumeric>

The passphrase defined to stop the server.

Required for --stop to function.

STOP.WAIT=<number>

The time (in seconds) to wait for confirmation that the running Jetty server has stopped. If not specified, the stopper waits indefinitely for the server to stop.

If the time specified elapses, without a confirmation of server stop, then the --stop command exits with a non-zero return code.

See an error or something missing? Contribute to this documentation at Github!(Generated: 2014-08-01T01:00:23-07:00)