views:

382

answers:

4

I have a little pet web app project I'd like to show someone who doesn't have an application server themselves (and who has no clue about application servers).

What is the easiest and quickest way for them to get my WAR file running with zero configuration, preferably something I could send along with or bundle with the WAR file? Is there a slimmed down version of Jetty, for example? Something else?

+2  A: 

If you're using maven, there's a jetty maven plugin that can deploy your war to an embedded instance of jetty.

But even otherwise, depending on what sort of stuff your app needs, jetty or even tomcat will do.

tunaranch
+3  A: 

You can create the slimmed down version yourself easily.

http://docs.codehaus.org/display/JETTY/Embedding+Jetty

http://jetty.mortbay.org/xref/org/mortbay/jetty/example/LikeJettyXml.html

To run embedded Jetty you need only the following jars on the classpath:

* servlet-api-2.5-6.x.jar
* jetty-util-6.x.jar
* jetty-6.x.jar


/usr/local/jetty-6.1.4/lib> ls -la servlet-api-2.5-6.1.4.jar jetty-*
-rw-rw-r--  1 wwwrun admin 476213 2007-06-15 08:42 jetty-6.1.4.jar
-rw-rw-r--  1 wwwrun admin 128026 2007-06-15 08:40 jetty-util-6.1.4.jar
-rw-rw-r--  1 wwwrun admin 131977 2007-06-15 08:40 servlet-api-2.5-6.1.4.jar

Very light...

Alternatively, the Maven plugin can work as well.

Vinko Vrsalovic
A: 

I would definitely just create an executable jar that embeds jetty and uses your war. The maven thing might be ok, but it's pretty easy to just write the single main function yourself.

Russell Leggett
+2  A: 

If you don't know or do not want to mess with maven you could try Jetty-runner

https://svn.codehaus.org/jetty-contrib/trunk/jetty-runner

jetty-runner.jar is one jar file that you can run from command line like so:

java -jar jetty-runner.jar my.war

Randin