.jrubyrc file not supporting `cext.enabled=true` #953

jwoertink opened this Issue Aug 13, 2013 · 4 comments


None yet

4 participants


My default JRuby uses 1.9.3 mode. I added a .jrubyrc file to my project containing


Then I was able to do ruby -v and see it was in 2.0.0 mode. This verified that the .jrubyrc file was being read. I tried to install the ox gem, and got

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/jeremy/.rvm/rubies/jruby-1.7.4/bin/jruby extconf.rb 
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

I tried closing my terminal, and re-opening, but still got the error. After I did export JRUBY_OPTS=-Xcext.enabled=true I was able to bundle the gem. So it seems the .jrubyrc file just ignored that option.

My system:
jruby 1.7.4 (2.0.0) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]
OSX 10.8.4

@BanzaiMan BanzaiMan was assigned Aug 15, 2013
@BanzaiMan BanzaiMan added a commit that closed this issue Aug 15, 2013
@BanzaiMan BanzaiMan Remove mention of .jrubyrc for C Extensi building [skip ci]
Fixes #953
Enabling C Extensions via `.jrubyrc` is not effective for building gems,
so remove the mention of it to avoid confusion.
@BanzaiMan BanzaiMan closed this in f1a63bf Aug 15, 2013

The problem with the .jrubyrc approach is that, during gem installation, you would be in the fetched source's directory, not where you invoke jruby -S gem (or equivalent).

.jrubyrc does set the value correctly, but it just won't take effect when you want it.

$ cat > .jrubyrc                                
$ jruby -v -e 'puts ENV_JAVA["jruby.cext.enabled"]'
jruby 1.7.5.dev (1.9.3p392) 2013-08-15 25edb17 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_25-b15 [darwin-x86_64]

ah, ok. So really it only would work if that .jrubyrc was in my home directory, or something a bit more global as opposed to the project directory. Thanks!


This is an old thread, but I´m having trouble with .jrubyrc. I´ve put it in my home directory and it doesn´t seem to change anything. I actually want to change the java heap size.


headius commented Apr 6, 2015

@rbotafogo Please open a new issue if you're having problems with .jrubyrc on a current version of JRuby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment