blob: 0c2d5842edfec34ca4f5a72d319358936ddd44ab [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Using start.jar</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="startup.html" title="Chapter&nbsp;9.&nbsp;Starting Jetty"><link rel="prev" href="startup.html" title="Chapter&nbsp;9.&nbsp;Starting Jetty"><link rel="next" href="startup-base-and-home.html" title="Managing Jetty Base and Jetty Home"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
hljs.initHighlightingOnLoad();
</script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
Version: 9.3.28.v20191105</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using start.jar</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="startup.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;9.&nbsp;Starting Jetty<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="startup-base-and-home.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
<span class="website">www.webtide.com</span></a></h5><p>
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 for sponsored feature development
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="start-jar"></a>Using start.jar</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="start-jar.html#executing-startjar">Executing start.jar</a></span></dt><dt><span class="section"><a href="start-jar.html#_start_jar_command_line_options">start.jar Command Line Options</a></span></dt></dl></div><p>The most basic way of starting the Jetty standalone server is to execute the <code class="literal">start.jar</code>, which is a bootstrap for starting Jetty with the configuration you want.</p><div class="screenexample"><pre class="screen">[jetty-distribution-9.3.28.v20191105]$ java -jar start.jar
2013-09-23 11:27:06.654:INFO:oejs.Server:main: jetty-9.3.28.v20191105
...</pre></div><p>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.</p><p>At its most basic, you configure Jetty from two elements:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A set of libraries and directories that make up the server classpath.</li><li class="listitem">A set of Jetty XML configuration files (IoC style) that establish how to build the Jetty server and its components.</li></ol></div><p>Instead of editing these directly, Jetty 9.1 introduced more options on how to configure Jetty (these are merely syntactic sugar that eventually resolve into the two basic configuration components).</p><p>Jetty Startup Features include:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">A separation of the Jetty distribution binaries in <code class="literal">${jetty.home}</code> and the environment specific configurations (and binaries) found in <code class="literal">${jetty.base}</code> (detailed in Managing Jetty Base and Jetty Home.)</li><li class="listitem">You can enable a set of libraries and XML configuration files via the newly introduced <a class="link" href="startup-modules.html" title="Managing Startup Modules">module system.</a></li><li class="listitem">All of the pre-built XML configuration files shipped in Jetty are now parameterized with properties that you can specify in your <code class="literal">${jetty.base}/start.ini</code> (demonstrated in <a class="link" href="quick-start-configure.html" title="Chapter&nbsp;3.&nbsp;An Introduction to Jetty Configuration">Quick Start Configuration</a>).</li></ul></div><p>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.</p><p>For example, if you use the <code class="literal">${jetty.base}</code> 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 <code class="literal">${jetty.base}</code>, and in the future, just upgrade your <code class="literal">${jetty.home}</code> directory with a new Jetty distribution.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executing-startjar"></a>Executing start.jar</h3></div></div></div><p>When executed <code class="literal">start.jar</code> performs the following actions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Loads and parses all INIs found in <code class="literal">${jetty.base}/start.d/*.ini</code> as command line arguments.</li><li class="listitem">Loads and parses <code class="literal">${jetty.base}/start.ini</code> as command line arguments.</li><li class="listitem">Parses actual command line arguments used to execute <code class="literal">start.jar</code> itself.</li><li class="listitem"><p class="simpara">Resolves any XML configuration files, modules, and libraries using base vs. home resolution steps:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Checks whether file exists as relative reference to <code class="literal">${jetty.base}.</code></li><li class="listitem">Checks whether file exists as relative reference to <code class="literal">${jetty.home}.</code></li><li class="listitem">Uses default behavior of <code class="literal">java.io.File</code> (Relative to <code class="literal">System.getProperty</code> ("user.dir") and then as absolute file system path).</li></ol></div></li><li class="listitem">Loads any dependent modules (merges XXNK, library, and properties results with active command line).</li><li class="listitem">Builds out server classpath.</li><li class="listitem"><p class="simpara">Determines run mode:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Shows informational command line options and exit.</li><li class="listitem">Executes Jetty normally, waits for Jetty to stop.</li><li class="listitem">Executes a forked JVM to run Jetty in, waits for forked JVM to exit.</li></ul></div></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_start_jar_command_line_options"></a>start.jar Command Line Options</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">--help</span></dt><dd>Obtains the current list of command line options and some basic usage help.</dd><dt><span class="term">--version</span></dt><dd>Shows the list of server classpath entries, and prints version information found for each entry.</dd><dt><span class="term">--list-classpath</span></dt><dd>Similar to --version, shows the server classpath.</dd><dt><span class="term">--list-config</span></dt><dd><p class="simpara">Lists the resolved configuration that will start Jetty.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Java environment</li><li class="listitem">Jetty environment</li><li class="listitem">JVM arguments</li><li class="listitem">Properties</li><li class="listitem">Server classpath</li><li class="listitem">Server XML configuration files</li></ul></div></dd><dt><span class="term">--dry-run</span></dt><dd>Prints the resolved command line that <code class="literal">start.jar</code> should use to start a forked instance of Jetty.</dd><dt><span class="term">--exec</span></dt><dd>Starts a forked instance of Jetty.</dd><dt><span class="term">--debug</span></dt><dd><p class="simpara">Enables debugging output of the startup procedure.</p><p class="simpara"><span class="strong"><strong>Note</strong></span>: This does not set up debug logging for Jetty itself.
For information on logging, please see the section on <a class="link" href="configuring-logging.html#configuring-jetty-logging" title="Configuring Jetty Logging">Configuring Jetty Logging.</a></p></dd><dt><span class="term">--start-log-file=&lt;filename&gt;</span></dt><dd><p class="simpara">Sends all startup output to the filename specified.</p><p class="simpara">Filename is relative to <code class="literal">${jetty.base}</code>.
This is useful for capturing startup issues where the Jetty-specific logger has not yet kicked in due to a possible startup configuration error.</p></dd><dt><span class="term">--list-modules</span></dt><dd><p class="simpara">Lists all the modules defined by the system.</p><p class="simpara">Looks for module files using the <a class="link" href="startup-base-and-home.html" title="Managing Jetty Base and Jetty Home">normal <code class="literal">${jetty.base}</code> and <code class="literal">${jetty.home}</code> resolution logic</a>.</p><p class="simpara">Also lists enabled state based on information present on the command line, and all active startup INI files.</p></dd><dt><span class="term">--module=&lt;name&gt;,(&lt;name&gt;)*</span></dt><dd><p class="simpara">Enables one or more modules by name (use <code class="literal">--list-modules</code> to see the list of available modules).</p><p class="simpara">This enables all transitive (dependent) modules from the module system as well.</p><p class="simpara">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 <code class="literal">${jetty.base}/start.ini.</code></p></dd><dt><span class="term">--add-to-start=&lt;name&gt;,(&lt;name&gt;)*</span></dt><dd><p class="simpara">Enables a module by appending lines to the <code class="literal">${jetty.base}/start.ini</code> file.</p><p class="simpara">The lines that are added are provided by the module-defined INI templates.</p><p class="simpara">Note: Transitive modules are also appended.</p></dd><dt><span class="term">--add-to-startd=&lt;name&gt;,(&lt;name&gt;)*</span></dt><dd><p class="simpara">Enables a module via creation of a module-specific INI file in the <code class="literal">${jetty.base}/start.d/</code> directory.</p><p class="simpara">The content of the new INI is provided by the module-defined ini templates.</p><p class="simpara">Note: Transitive modules are also created in the same directory as their own INI files.</p></dd></dl></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-asterisk" aria-hidden="true"></i> Note</h3><p>With respect to <code class="literal">start.ini</code> and <code class="literal">start.d/*.ini</code> files, only <span class="strong"><strong>one</strong></span> of these methods should be implemented.
Mixing a <code class="literal">start.ini</code> with module specific ini files in the <code class="literal">{$jetty.base}/start.d</code> directory can lead to server issues unless great care is taken.</p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">--write-module-graph=&lt;filename&gt;</span></dt><dd><p class="simpara">Advanced feature: Creates a graphviz <a class="link" href="http://graphviz.org/content/dot-language" target="_top">dot file</a> of the module graph as it exists for the active <code class="literal">${jetty.base}</code>.</p><div class="screenexample"><pre class="screen"># 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</pre></div><p class="simpara">See <a class="link" href="http://graphviz.org/" target="_top">graphviz.org</a> for details on <a class="link" href="http://graphviz.org/content/command-line-invocation" target="_top">how to post-process this dotty file</a> into the output best suited for your needs.</p></dd><dt><span class="term">--create-files</span></dt><dd>Create any missing files that are required by initialized modules.
This may download a file from the network if the module provides a URL.</dd><dt><span class="term">--skip-file-validation=&lt;modulename&gt;(,&lt;modulename)*</span></dt><dd>Disable the [files] section validation of content in the <code class="literal">${jetty.base}</code> directory for a specific module.
Useful for modules that have downloadable content that is being overridden with alternatives in the <code class="literal">${jetty.base}`</code> directory.</dd></dl></div><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-exclamation" aria-hidden="true"></i> Caution</h3><p>This advanced option is for administrators that fully understand the configuration of their <code class="literal">${jetty.base}</code> and are willing to forego some of the safety checks built into the jetty-start mechanism.</p></div></blockquote></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">--approve-all-licenses</span></dt><dd>Approve all license questions.
Useful for enabling modules from a script that does not require user interaction.</dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_startup_shutdown_command_line"></a>Startup / Shutdown Command Line</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">--stop</span></dt><dd><p class="simpara">Sends a stop signal to the running Jetty instance.</p><p class="simpara">Note: The server must have been started with various stop properties for this to work.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">STOP.PORT=&lt;number&gt;</span></dt><dd><p class="simpara">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.</p><p class="simpara">Required for --stop to function.</p></dd><dt><span class="term">STOP.KEY=&lt;alphanumeric&gt;</span></dt><dd><p class="simpara">The passphrase defined to stop the server.</p><p class="simpara">Required for --stop to function.</p></dd><dt><span class="term">STOP.WAIT=&lt;number&gt;</span></dt><dd><p class="simpara">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.</p><p class="simpara">If the time specified elapses, without a confirmation of server stop, then the <code class="literal">--stop</code> command exits with a non-zero return code.</p></dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_advanced_commands"></a>Advanced Commands</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">--lib=&lt;classpath&gt;</span></dt><dd>Add arbitrary classpath entries to the the server classpath.</dd><dt><span class="term">--include-jetty-dir=&lt;path&gt;</span></dt><dd>Include an extra Jetty directory to use as a source for configuration details.
This directory behaves similarly to <code class="literal">${jetty.base}</code> but sits at a layer between <code class="literal">${jetty.base}</code> and <code class="literal">${jetty.home}</code>.
This allows for some complex hierarchies of configuration details.</dd><dt><span class="term">--download=&lt;http-uri&gt;|&lt;location&gt;</span></dt><dd>If the file does not exist at the given location, download it from the given http URI.
Note: location is always relative to <code class="literal">${jetty.base}</code>.
You might need to escape the slash "\|" to use this on some environments.</dd></dl></div></div></div></div><script type="text/javascript">
SyntaxHighlighter.all()
</script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="startup.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="startup.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="startup-base-and-home.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;9.&nbsp;Starting Jetty&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Managing Jetty Base and Jetty Home</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
See an error or something missing?
<span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
<span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2019-11-05)</i></span></div></p></body></html>