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"

(Downloading Other Binaries)
(Configuring Jetty)
Line 85: Line 85:
 
== Configuring Jetty ==
 
== Configuring Jetty ==
  
[[Jetty/Configuration|Configuration Documentation]]
+
To run Jetty with specific configuration files, do
<!-- add more detail! -->
+
 
 +
java -jar start.jar etc/jetty.xml etc/jetty-....
 +
 
 +
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
 +
  java -jar start.jar
 +
 
 +
is exactly the same as
 +
  java -jar start.jar etc/jetty.xml
 +
 
 +
The <tt>etc/jetty.xml</tt> 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 [[Jetty/Configuration|Configuration Documentation]].
  
 
== Deploying Web Applications ==
 
== Deploying Web Applications ==

Revision as of 06:13, 19 June 2009



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  INCUBATION.txt  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
INCUBATION.TXT 
README explaining Jetty's current incubation status within the Eclipse project
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.

Warning

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
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-....

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. 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.

Deploying Web Applications

The default installation of Jetty is configured to deploy webapps by looking in two places: $JETTY_HOME/webapps and $JETTY_HOME/contexts.

You can put your standard webapps in $JETTY_HOME/webapps, 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 $JETTY_HOME/contexts.

Note.png
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 from Source.

Back to the top