How to run Ruby 2.0 with JRuby 1.7?

Sébastien Le Callonnec picture Sébastien Le Callonnec · Mar 7, 2013 · Viewed 9.1k times · Source

What is the best way to get JRuby to run in 2.0 mode?

Answer

Sébastien Le Callonnec picture Sébastien Le Callonnec · Mar 7, 2013

For a specific script, you can use the --2.0 option:

jruby --2.0 -S rails s

For setting 2.0 as the default value, set JRUBY_OPTS:

export JRUBY_OPTS=--2.0

You can also set the value in ~/.jrubyrc:

compat.version=2.0