How to make JRuby 1.6 default to Ruby 1.9?

Use the JRUBY_OPTS environment variable. JRUBY_OPTS holds a list of arguments that are added to any arguments specified on the command line.

For example (on Linux):

$ jruby -v
jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-10 769f847) (Java HotSp...
$ export JRUBY_OPTS=--1.9
$ jruby -v
jruby 1.6.0.RC1 (ruby 1.9.2 trunk 136) (2011-01-10 769f847) (Java HotSpot(TM...
$ export JRUBY_OPTS=--1.8
$ jruby -v
jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-10 769f847) (Java HotSpo...

Leave a Comment