2011-09-05

Starting and Stopping Jetty Web Server

I’ve looked at Jetty a few times in the past but could not even find documentation on how to start or stop the dang thing. Trying to use Vaadin has brought me once again to Jetty, version 8.

I don't know if this is necessary, but after unzipping the downloaded Jetty file, I drag and drop the resulting folder to the BatChmod app. I check all the checkboxes except 'Clear xattrs'.

I finally discovered how to start and stop Jetty on Mac OS X. It's easy. While Apache Tomcat has an explicit start and stop shell script (.sh files), Jetty uses a single shell script for both purposes. You pass the word 'start' or 'stop' without any quotes.

To start Jetty web server:
  1. Locate the shell script: …/YourJettyFolder/bin/jetty.sh
  2. Drag and drop that script file to a terminal window in either Terminal.app or Path Finder.
  3. Type a space and the word 'start'. Press Return key.
Example:
/Users/basilbourque/jetty-distribution-8.0.0.v20110901/bin/jetty.sh start

You’ll see something like this:
Starting Jetty: STARTED Jetty Mon Sep  5 16:39:26 PDT 2011

To stop Jetty web server:
  1. Press the Up Arrow key to repeat the previous line at the command line.
  2. Press Backspace to replace the word 'start' with the word 'stop'.
  3. Press Return to execute that line.
You’ll see something like this:
Stopping Jetty: OK

To verify Jetty is running and verify its configuration, pass the word check rather than start or stop.

Jetty defaults to port 8080. So to try it, point your web browser to:
http://localhost:8080/
To use port 80, see my other posts on port-forwarding.

I’m working on an Intel MacBook with Core 2 Duo running Mac OS X 10.6.7 with Java version "1.6.0_26" 64-bit.

2 comments: