Ruby2Jar

Ruby2Jar builds JAR from a Ruby script. It copies gems, compiles sources and packages JAR. It is an easy way to distribute your JRuby application or create Applet or Java Web Start.

Ruby2Jar was developed by Andrey “A.I.” Sitnik and was licensed under GNU GPL 3. You can find repository on GitHub.

Installation

gem install ruby2jar

You must have JDK to use JAR builder. Also you should run it from JRuby for correct platform in gems.

Usage

Add task to build JAR in Rakefile:

require "rubygems"
require "ruby2jar"

PKG_NAME = "program"
PKG_VERSION = "0.1"

Ruby2Jar::Rake::JarTask.new do |jar|
  jar.files = FileList["lib/**/*", "bin/*"]
  jar.main = "bin/program"
  jar.name = PKG_NAME
  jar.version = PKG_VERSION
  jar.add_dependency "rspec"
end