Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make JRuby 1.6 default to Ruby 1.9?

Tags:

jruby

what is the best way to make JRuby to run in 1.9 mode by default?

i.e, I want to run rake test instead of jruby --1.9 -S rake test

Thank you

like image 762
arkadiy kraportov Avatar asked Jan 21 '11 06:01

arkadiy kraportov


2 Answers

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... 
like image 94
toddsundsted Avatar answered Sep 19 '22 13:09

toddsundsted


An alternative solution is to put the following line (and other settings) in your ~/.jrubyrc file

compat.version=1.9 
like image 33
Alex Blakemore Avatar answered Sep 21 '22 13:09

Alex Blakemore