Although I will add that while it loads in irb, it doesn’t seem to
actually
work…so there is the question of why it “loads,” but also, what might
be a
common cause as to why a gem doesn’t work with jruby, and what I can do
to
fix it.
ree? sounds like not jruby, but maybe I’m misreading something here.
Solution further down in this email.
however…
$ jruby test.rb
LoadError: no such file to load – tweetstream
require at org/jruby/RubyKernel.java:1038
(root) at test.rb:1
% jruby -e ‘require “tweetstream”; puts :OK’
LoadError: no such file to load – tweetstream
require at org/jruby/RubyKernel.java:1038
(root) at -e:1
The problem here (reproduced for you) is that you have not yet required
rubygems - you must require rubygems for jruby (at least in 1.8.7 mode)
to
find any gems you have installed.
% jruby -e ‘require “rubygems”; require “tweetstream”; puts :OK’
OK
No corners necessary! I appreciate the help (a lot).
Ah, the require ‘rubygems.’ That makes sense. I guess the question now:
why
is “jruby -S irb” sensitive to the version of irb that I have? My guess
would be that the -S irb is simply running the ruby REPL code in jruby,
and
isn’t it’s own implementation, so it detects that the default ruby
install,
and then runs the irb code from that install, but using jruby? So if I
am
using rvm to install various version of ruby, how would I choose which
irb
to run? Is jruby -S gem the same way? How can I control which version of
ruby the jruby gem installer is working through? I think I’m having
version
and whatnot issues… can rvm+gemspec handle this? It sounds like even
if
you do rvm jruby-head@mygemspec, gem install whatever won’t actuall
install
to jruby?