Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Starting/Installing Jetty-7.0.x"

(Inspect the Distribution)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{warning|This page is deprecated|We are splitting it up into different pages. Once all the information here is available elsewhere, the page will be wiped}}
 
{{Jetty}}
 
{{Jetty}}
  
 
== Introduction ==  
 
== Introduction ==  
The following provides detailed instructions for downloading and installing the latest version of Jetty 7. If you just want to get up and running, see the [[Jetty/Getting Started/Quick Start Guide|Quick Start Guide]].
+
The following provides detailed instructions for downloading and installing the latest version of Jetty 7. If you just want to get up and running, see the [[Jetty/Starting/Quick Start Guide|Quick Start Guide]].
  
 
== Prerequisites ==
 
== Prerequisites ==
Line 64: Line 65:
 
This starts Jetty running on port 8080.
 
This starts Jetty running on port 8080.
  
{{warn
+
{{warning|Jetty will not start if another process is using port 8080|The port number can be changed by editing the <tt>$JETTY_HOME/etc/jetty.xml</tt> file. For more details see [[Jetty/Configuration|Configuring Jetty]]. The rest of the instructions in this wiki will assume that you are using port 8080}}
|Jetty will not start if another process is using port 8080. The port number can be changed by editing the <tt>$JETTY_HOME/etc/jetty.xml</tt> file. For more details see [[Jetty/Configuration|Configuring Jetty]]. The rest of the instructions in this wiki will assume that you are using port 8080}}
+
  
 
== Stopping Jetty ==
 
== Stopping Jetty ==
Line 77: Line 77:
 
  http://localhost:8080/test
 
  http://localhost:8080/test
  
{{note
+
{{note|Port and host defaults|If you started Jetty on another host, substitute that host name for <var>localhost</var>. If you used a different port number you will also need to change <var>8080</var> to the correct number. Unless otherwise noted, the rest of the instructions in this wiki will assume that you are using <var>localhost</var> and port <var>8080</var>.
|If you started Jetty on another host, substitute that host name for <var>localhost</var>. If you used a different port number you will also need to change <var>8080</var> to the correct number. Unless otherwise noted, the rest of the instructions in this wiki will assume that you are using <var>localhost</var> and port <var>8080</var>.
+
 
}}
 
}}
  
Line 85: Line 84:
 
To run Jetty with specific configuration files, do
 
To run Jetty with specific configuration files, do
  
  java -jar start.jar etc/jetty.xml etc/jetty-....
+
  java -jar start.jar etc/jetty.xml etc/jetty-someotherfile.xml etc/myconfiguration.xml
  
The part of the command following <tt>-jar start.jar</tt> specifies the names of configuration files. These files instruct Jetty which ports to listen on, which webapps to deploy, and generally configure all container-related customizable settings. You may have only one configuration file, or you may have many, depending on your needs. Running Jetty with  
+
The part of the command following <tt>-jar start.jar</tt> specifies the names of configuration files. These files instruct Jetty which ports to listen on, which webapps to deploy, and generally configure all container-related customizable settings. You may have only one configuration file, or you may have many, depending on your needs. These configuration files may be any name you want.
 +
 
 +
Running Jetty with  
 
   java -jar start.jar  
 
   java -jar start.jar  
  
Line 96: Line 97:
  
 
In-depth configuration information can be found in [[Jetty/Configuration|Configuration Documentation]].
 
In-depth configuration information can be found in [[Jetty/Configuration|Configuration Documentation]].
 +
 +
== Configuring Jetty Classpath on Startup ==
 +
 +
To control what files are available through the classpath, pass in options  when starting Jetty, e.g.,
 +
 +
  java -jar start.jar OPTIONS=jetty,jsp,ssl
 +
 +
The default options are <tt>OPTIONS=default,*</tt>, which make available the modules for basic Jetty functionality, the <tt>$(jetty.home)/lib/ext directory</tt>, and the <tt>$(jetty.home)/resources</tt> directory.
 +
 +
A reference guide for the start.jar mechanism which controls the OPTIONS behavior can be found at [[Jetty/Reference/Customizing Startup]].
  
 
== Deploying Web Applications ==
 
== Deploying Web Applications ==
  
The default installation of Jetty is configured to deploy webapps by looking in two places: <tt>$JETTY_HOME/webapps</tt> and <tt>$JETTY_HOME/contexts</tt>.
+
The default installation of Jetty is configured to look for standard webapps in <tt>$JETTY_HOME/webapps</tt>. Webapps here will be discovered at startup, and do not support hot deployment.
  
You can put your standard webapps in <tt>$JETTY_HOME/webapps</tt>, where it will be discovered at startup; it does not support hot deployment. For non-standard contexts, or if you need to support hot deployment, you need to put XML configuration files to configure your contexts into <tt>$JETTY_HOME/contexts</tt>. <!-- link to relevant page! -->
+
For non-standard contexts, or if you need to support hot deployment, put XML configuration files to configure your contexts into <tt>$JETTY_HOME/contexts</tt>. <!-- link to relevant page! -->
  
{{note
+
{{tip|Root context|The easiest way to make your webapp the root context (/) is to name it "root.war".}}
|The easiest way to make your webapp the root context (/) is to name it "root.war".
+
}}
+
  
 
== Downloading Other Binaries ==
 
== Downloading Other Binaries ==
  
Other available binaries and packages for download are listed on [[Jetty/Getting_Started/Downloads|Downloads]].
+
Other available binaries and packages for download are listed on [[Jetty/Starting/Downloads|Downloads]].
  
 
== Obtaining and Building from Source ==
 
== Obtaining and Building from Source ==
Line 120: Line 129:
 
* [http://svn.codehaus.org/jetty/jetty/trunk/ Jetty 7 additional accessories and integrations]  
 
* [http://svn.codehaus.org/jetty/jetty/trunk/ Jetty 7 additional accessories and integrations]  
  
Follow the rest of the instructions on [[Jetty/Contributors/Building|Building]].
+
Follow the rest of the instructions on [[Jetty/Contributor/Building|Building]].
 +
 
 +
[[Category:Jetty Starting]]

Latest revision as of 05:38, 12 August 2009

Warning2.png
This page is deprecated
We are splitting it up into different pages. Once all the information here is available elsewhere, the page will be wiped



Introduction

The following provides detailed instructions for downloading and installing the latest version of Jetty 7. If you just want to get up and running, see the Quick Start Guide.

Prerequisites

Hardware

  • ~7 MB of disk space for Jetty source
  • ~7 MB for Jetty 7 binaries

Operating System

  • Any operating system that supports J2SE 1.5 or greater.

Environment

Downloading and Installing the Jetty Core Components Binary

Download the Binary

The Jetty core component binaries can be found on the Jetty downloads page.

Unpack the Binary

Unzip the binary; it will be extracted into a directory called jetty-distribution-VERSION. The rest of the instructions in this wiki will refer to this location as $JETTY_HOME.

Inspect the Distribution

Unzip the distribution you just downloaded. The top-level directory should look like:

about.html  contexts            etc   javadoc  LICENSE-APACHE-2.0.txt    logs      notice.html  resources  webapps
bin         contexts-available  lib   LICENSE-ECLIPSE-1.0.html  META-INF  README.txt   start.jar
about.html 
"About This Content" page from Eclipse
bin 
directory for shell scripts to help automate the building and running of Jetty
contexts 
hot deploy directory
contexts-available 
directory for additional example contexts
etc 
directory for Jetty configuration files
javadoc 
contains the javadoc; needs to be built first
lib 
contains all the JAR files necessary to run jetty-7
LICENSE-APACHE-2.0.TXT 
license file for Jetty (Jetty 7 is dual-licensed)
LICENSE-ECLIPSE-1.0.HTML 
license file for Jetty (Jetty 7 is dual-licensed)
logs 
directory for request logs
META-INF 
for packaging
notice.html 
licenses applicable to Jetty, as well as any exceptions
README.TXT 
contains useful getting started information
resources 
directory containing additional resources for configuration
start.jar 
JAR which invokes jetty-7 (see also Running Jetty)
webapps 
directory containing webapps which will be run under the default configuration of Jetty; contains demo webapps

Starting Jetty

To start Jetty, open the command shell, and:

cd $JETTY_HOME
java -jar start.jar

This starts Jetty running on port 8080.

Warning2.png
Jetty will not start if another process is using port 8080
The port number can be changed by editing the $JETTY_HOME/etc/jetty.xml file. For more details see Configuring Jetty. The rest of the instructions in this wiki will assume that you are using port 8080


Stopping Jetty

From the command shell where Jetty is running, type <ctrl-c>

Testing Jetty

When Jetty starts, it deploys a test web application on port 8080. To check if Jetty is running properly navigate to the test URL from a browser. For example:

http://localhost:8080/test
Note.png
Port and host defaults
If you started Jetty on another host, substitute that host name for localhost. If you used a different port number you will also need to change 8080 to the correct number. Unless otherwise noted, the rest of the instructions in this wiki will assume that you are using localhost and port 8080.


Configuring Jetty

To run Jetty with specific configuration files, do

java -jar start.jar etc/jetty.xml etc/jetty-someotherfile.xml etc/myconfiguration.xml

The part of the command following -jar start.jar specifies the names of configuration files. These files instruct Jetty which ports to listen on, which webapps to deploy, and generally configure all container-related customizable settings. You may have only one configuration file, or you may have many, depending on your needs. These configuration files may be any name you want.

Running Jetty with

 java -jar start.jar 

is exactly the same as

 java -jar start.jar etc/jetty.xml

The etc/jetty.xml file that is provided in the distribution includes many examples of alternative configuration settings that can be uncommented. For your convenience, this configuration instructs Jetty to deploy all webapps found in the webapps directory. Therefore, in order to deploy a new webapp, you need not do anything more than drop your war file or unpacked war file into the webapps directory.

In-depth configuration information can be found in Configuration Documentation.

Configuring Jetty Classpath on Startup

To control what files are available through the classpath, pass in options when starting Jetty, e.g.,

 java -jar start.jar OPTIONS=jetty,jsp,ssl

The default options are OPTIONS=default,*, which make available the modules for basic Jetty functionality, the $(jetty.home)/lib/ext directory, and the $(jetty.home)/resources directory.

A reference guide for the start.jar mechanism which controls the OPTIONS behavior can be found at Jetty/Reference/Customizing Startup.

Deploying Web Applications

The default installation of Jetty is configured to look for standard webapps in $JETTY_HOME/webapps. Webapps here will be discovered at startup, and do not support hot deployment.

For non-standard contexts, or if you need to support hot deployment, put XML configuration files to configure your contexts into $JETTY_HOME/contexts.

Idea.png
Root context
The easiest way to make your webapp the root context (/) is to name it "root.war".


Downloading Other Binaries

Other available binaries and packages for download are listed on Downloads.

Obtaining and Building from Source

You can also build a custom version of Jetty from the source code.

Check out the source code using SVN:

Follow the rest of the instructions on Building.

Back to the top