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.
gem install ruby2jar
You must have JDK to use JAR builder. Also you should run it from JRuby
for correct platform in gems.
Add task to build JAR in Rakefile:
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