On Jan 27, 9:43 ¨Âí¬ ÂòùáÒéãèáòäóïî ¼âôòéãèáòä®®®Àçíáéì®ãïí¾ ÷òïôåº > Hello all, > > I'm writing a program that may or may not require to be run in JRuby, > depending on the interface wanted by the user. A couple of the gems I'm > using in the project have different versions based on whether JRuby is > used. One example is the SQLite3 library for DataObjects (do_sqlite3). I > installed the gem using Ruby via 'gem install do_sqlite3' and using > JRuby via 'jruby -S gem install do_sqlite3'. This resulted in two gems > actually being installed: > > do_sqlite3-0.10.1.1-java > do_sqlite3-0.10.1.1 > > The only difference between the two gems is do_sqlite3.so vs > do_sqlite3.jar. > > When I run my program via Ruby it still tries to use the > do_sqlite3-0.10.1.1-java gem (I assume because it comes first on the > file system). I had assumed that rubygems would only load the -java > versions of gems when the RUBY_PLATFORM was java, but I guess that's not > the case. Is it possible for me to force the non-java version of the gem > to be used when the RUBY_PLATFORM is not java? > That means you installed "-java" version of the gem in MRI. Using normal gem installation process, that gem will not be installed. Depending on "do_sqlite3" will resolve to the appropriate platform version. You should remove java version from your Ruby installation and try packaging your gem with the do_sqlite3 dependency. Then a normal gem installation will trigger the dependency and the proper platform depending on the Ruby interpreter used by the user (or you) -- Luis Lavena