/jar-hello-world

This is just the jetty-hello-world program packaged as a single jar.

Primary LanguageRuby

JRuby+Jetty+JAR Hello World

Overview

This is an example “Hello World” web application as a demonstration for bundling a JRuby application with JAR dependencies up into a single unified JAR you can run with the only deployment requirement being a working Java on your target system.

This way if you have a system that’s already running a particular JRuby release, you can “vendor all the things” and deploy an application like this without worrying about breaking anything on your server since you don’t have to muck with any existing Ruby environment, Gems, Bundler, et all.

This article helped me figure out most of the tricky bits in writing this example. So many thanks to @tomdz.

Prerequisites

OpenJDK 7u6

  1. Downloaded the package for OSX
  2. Mount it
  3. Drag the 1.7.0u6.jdk you should find to /Library/Java/JavaVirtualMachines
  4. Select the new version as the default in Java Preferences (look for it with Spotlight)

Usage

From the root of the project run:

mvn clean install

Then you can just start it up!

java -jar target/jetty-hello-world-1.0.0-SNAPSHOT.jar

Benchmarking

To benchmark I run this:

httperf --num-conns=50 --num-calls=2000 --port 9292

After warm-up the second time I get over 7,000 requests per second.