JRuby in a JAR

A bit of fairy dust, a sprinkle of elven blood, lots of water and boil it all for 5 hours on a low fire. What you get? … I wouldn’t know, but I do know that it took me almost 2 whole days to grasp the idea of a JRuby in a JAR, with two bootstrappers!

Let’s assume that I wrote this great utility that does this magnificent function that will help mankind. And this utility/software needs a computer to run. Now, I speak Ruby quite well – and specify my behavior thoroughly with RSpec. But alas – most computers don’t have ruby installed (Java JRE yes, Ruby no, especially in enterprises).

So let’s also assume that some giants wrote a Ruby interpreter that can run on a JVM, and called it JRuby. And further more assume that most java “utilities” can be written inside a single jar, and can be executed with:

java -jar fairy_dust.jar

How can I take my ruby code and have it run just like the above? With just a single file and all …

1. JRuby
2. One-jar
3. Custom Bootstrapper

And the result is – a JAR file, with multiple Ruby files inside – that works just like a java jar:

java -jar rubified.jar

And you can get all the above (with the ant build.xml) for the price of one download!

Presenting: Rubified 0.1 BETA