I need to compile my jruby application into a standalone jar. How can I do this?
To just run a script:
The jruby site has a runnable jar that you can get at the jruby download page. You want the jruby complete jar. You can then run your app by doing a java -jar jruby-complete-1.4.0.jar <script>
I believe you can also build the same jar from source. In the downloaded source do an ant --projecthelp
To embed a ruby script into completely into a jar: Ebedding jruby in java is a good starting point. You will probably want to unjar the jruby-complete.jar, add your java main class that either has the a callout to a jruby script or has the ruby code embedded in it, replace the manifest's main class to point to your new entry point, and jar it back up.
Check out http://rawr.rubyforge.org/ is a gem that packages your app in a jar.
If you want to compile for source code protection you must produce a .class file for each script in your project (as described here: kenai.com/projects/jruby/pages/JRubyCompiler ) and than replace the contents of the original script with require 'the_corresponding_class_file'
for each of the compiled scripts.