IIRC, the "spirit" of jruby -x is to be like perl -x, and be able to do something like this:
The "-x" parsing code calls findScript, which looks for the first line containing starting with "#Unable to render embedded object: File (" and >2 characters. Unfortunately, this finds the #) not found./bin/sh line. The code should skip the first line (presumably a #! for another interpreter that will exec jruby -x ...). I'm trying to do this so I can have a command line script that's run with jruby 1.9 (and doesn't require the user to set an environment variable or something; other suggestions welcome).
This is basically how the perl interpreter deals with -x (it actually requires the #! it finds has perl in it somewhere). For example: