What we could do is simply serialize or embed the Ruby script
into a class file along with wrapper code to handle JRuby specifics.
What you would essentially have is a class that could be classloaded
as normal, and that loading process would prime JRuby with appropriate
Ruby definitions. Ultimately what happens behind the scenes is just
that the class itself calls out to JRuby or JRuby is made aware of the
class, and from there the normal Ruby script parsing happens.
I believe this is the start of what groovyc does for groovy. I don't know the specifics of how much farther groovyc goes to turn groovy code into java bytecode, but I suspect they're doing some compilation down to actual java bytecode where possible.
/Nick