BiteScript is a Ruby DSL for generating JVM bytecode and classes. It is 
used by the Duby programming language and by the upcoming "compiler2" 
Ruby-to-Java compiler in JRuby.

Project page: http://kenai.com/projects/jvmscript

Install: gem install bitescript

Dependencies: JRuby 1.2 or higher

Changes:

* First public release. Most features up to Java 1.4 are supported plus 
Java 5 annotations.

Sample code:

require 'bitescript'

include BiteScript

fb = FileBuilder.build(__FILE__) do
   public_class "SimpleLoop" do
     public_static_method "main", void, string[] do
       aload 0
       push_int 0
       aaload
       label :top
       dup
       aprintln
       goto :top
       returnvoid
     end
   end
end

fb.generate do |filename, class_builder|
   File.open(filename, 'w') do |file|
     file.write(class_builder.generate)
   end
end