Installing and Running Jetty
Join the DZone community and get the full member experience.Join For Free
This tutorial will walk you through how to download, install and run Jetty – a 100 % Java HTTP and Servlet Container.
If you do not know Jetty, the following is what Wikipedia says about it:
Jetty is a pure Java-based HTTP server and servlet container (Application server) developed as a free and open source project as part of the Eclipse Foundation. It is currently used in products such as ActiveMQ,Alfresco, Apache Geronimo,Apache Maven, Google App Engine,Eclipse,FUSE,HP OpenView, JBoss,Liferay,Ubuntu, Twitter’s Streaming API and Zimbra. Jetty is also used as a standard Java application server by many open source projects such as Eucalyptus and Hadoop.
So let’s get this server up and running!
1 – Downloading
You can download Jetty from two sources: Eclipse or Codehaus.
The current stable version is 7, so I downloaded this one from Eclipse page.
The compressed file is platform independent. So if you use Mac, Linux or Windows, that is ok, it will run on any OS.
2 – Installing
Simply uncompress the file to a directory. You should have something like this:
Installation is complete! Let’s get it running.
3 – Running Jetty
- Open a terminal.
- Go to the Jetty installation directory.
- Enter the following command:
java -jar start.jar
Now open a browser and go to localhost to check if Jetty was installed sucessfully:
You should get a page like this:
And it is done!
Opinions expressed by DZone contributors are their own.