Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use JRUBY_OPTS with RVM?

It seems that the idiomatic way to provide flags to JRuby in an RVM-based Rails project is to set the environmental variable JRUBY_OPTS or PROJECT_JRUBY_OPTS, the latter perhaps being done automatically, since I see I can uncomment this line from my project directory's .rvmrc:

PROJECT_JRUBY_OPTS=( --1.9 )

However, that line seems to do nothing, and if I set the environmental variables, RVM actually unsets them.

So, how am I supposed to do this?

(Note that I have this at the bottom of my .bashrc file, which is how I believe I'm supposed to use rvm:)

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

Example:

$ JRUBY_OPTS=--1.9 jruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_27) [darwin-x86_64-java]

$ export JRUBY_OPTS=--1.9
$ jruby -v
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_27) [darwin-x86_64-java]
$ env | grep JRUBY_OPTS
[empty result]
like image 269
Paul Biggar Avatar asked Nov 27 '11 02:11

Paul Biggar


People also ask

Which is better RVM or Rbenv?

RVM is easier to install than Rbenv, RVM has more features than Rbenv, RVM includes a built-in Ruby installation mechanism while Rbenv does not.

Does RVM use Ruby version?

Ruby Version Manager (RVM) is a utility that allows you to add your own personal version of Ruby to a user. It allows you to add, remove, or have multiple versions of Ruby and its libraries live in your user directory.

What is RVM command?

RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.


1 Answers

Since your are using rvm just create a file .ruby-env in your directory folder. Inside the file you can define your custom env. Like:

JRUBY_OPTS=-Xcext.enabled=true
like image 134
raskhadafi Avatar answered Sep 19 '22 18:09

raskhadafi