Running jetty6 is as simple as going to your jetty installion directory and typing:
This will start jetty and deploy a demo webapp available at:
The part of the runline 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. More on this later.
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
jetty6 will not hot-deploy webapps after it has started. You must stop and then restart jetty6 to pick up the new webapp. If you are interested in using hot-deployment, take a look at the jetty6 maven2 plugin.
Apart from stopping jetty with a
cntrl-c in the same terminal window as you started it, you can use the following command in a different terminal window:
This will stop a jetty instance that was started by a command such as the one in the Running section. Whenever jetty starts up, it opens up a port (by default this is port
8079) and starts a thread to listen for "stop" messages. The "--stop" argument to a second invocation of jetty tells that instance to send the "stop" message on a port (again, by default this will be port
If you need to change the port on which jetty listens for stop messages, for example because that port is already in use or perhaps you want to run multiple instances of jetty, you use the system property
Additionally, if you want to protect against accidental or unauthorized stops, you can ask jetty to generate and print a special random key when starting that must also be provided in order to stop it: