# JRUBY does not find installed gem

**URL:** <https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101>\
**Category:** Ruby\
**Created:** [May 14, 2007, 11:16am UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101 "2007-05-14T11:16:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 14, 2007, 11:16am UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/1 "2007-05-14T11:16:34Z")

</div>

It seems that I am hunted with library search problems…

I installed the net-ssh Gem, and gem indeed installed it at the  
default library for Jruby, but still my program can’t find the  
library!

Here is the installation command and its output:

H:\dl\lang\net-ssh-1.1.1\>gem install net-ssh  
Bulk updating Gem source index for: [http://gems.rubyforge.org](http://gems.rubyforge.org)  
Install required dependency needle? [Yn] y  
Successfully installed net-ssh-1.1.1  
Successfully installed needle-1.3.0  
Installing ri documentation for net-ssh-1.1.1…  
Installing ri documentation for needle-1.3.0…  
Installing RDoc documentation for net-ssh-1.1.1…  
Installing RDoc documentation for needle-1.3.0…

This is my Gem environment:

C:\ruby185\lib\ruby\site\_ruby\>gem environment  
RubyGems Environment:

- VERSION: 0.9.1 (0.9.1)
- INSTALLATION DIRECTORY: H:/jruby-0.9.9/lib/ruby/gems/1.8
- GEM PATH:
  - H:/jruby-0.9.9/lib/ruby/gems/1.8

- REMOTE SOURCES:
  - [http://gems.rubyforge.org](http://gems.rubyforge.org)

But when I want to run the following program, I get an error message  
saying  
that net/ssh is not found:

H:\tmp\>type t2.rb  
require ‘socket’  
require ‘net/telnet’  
require ‘net/ssh’

H:\tmp\>jruby t2.rb  
t2.rb:3:in `require’: no such file to load – net/ssh (LoadError)  
from t2.rb:3

Since the library was installed using the “gem” command, jruby should  
be able to locate it automatically, doesn’t it?

## Ronald

Ronald F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Phone: +49-89-452133-162

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 14, 2007, 2:00pm UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/2 "2007-05-14T14:00:59Z")

</div>

On 5/14/07, Ronald F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Install required dependency needle? [Yn] y  
> C:\ruby185\lib\ruby\site\_ruby\>gem environment  
> saying
> 
> Since the library was installed using the “gem” command, jruby should  
> be able to locate it automatically, doesn’t it?

I don’t know much about jruby, but in normal ruby (MRI) you have to  
require ‘rubygems’, either by adding this line to the source, running  
ruby -rubygems or setting $RUBYOPT to rubygems.

Note: If rubygems are loaded you get a different message when a file  
is not loaded, similar to the following:

/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require__': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’  
from /usr/local/lib/ruby/site\_ruby/1.8/rubygems/package.rb:9  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’  
from /usr/local/lib/ruby/site\_ruby/1.8/rubygems.rb:61:in  
`manage\_gems’  
…

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 14, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/3 "2007-05-14T15:47:18Z")

</div>

> I don’t know much about jruby, but in normal ruby (MRI) you have to  
> require ‘rubygems’, either by adding this line to the source, running  
> ruby -rubygems or setting $RUBYOPT to rubygems.

RUBYOPT _is_ set to -rubygems, so I guess it is a Jruby problem.

As it turns out, I got an email by Jamis B. (the author of net-ssh),  
that  
this package would not run with Jruby anyway, so I need to look for a  
completely different solution.

Thank you for helping, though… I wonder whether there is a specific  
mailing  
list devoted to compatibility issues between Ruby and JRuby. Right now,  
I’m  
doing a lot of trial and error, to find out what Ruby stuff happens to  
work  
under JRuby.

Ronald

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 14, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/4 "2007-05-14T20:00:42Z")

</div>

Ronald F. wrote:

> Thank you for helping, though… I wonder whether there is a specific  
> mailing  
> list devoted to compatibility issues between Ruby and JRuby. Right now,  
> I’m  
> doing a lot of trial and error, to find out what Ruby stuff happens to  
> work  
> under JRuby.

Also, please do update the wiki ([headius.com/jrubywiki](http://headius.com/jrubywiki)) with everything  
you find out 🙂

- Charlie

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 14, 2007, 7:58pm UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/5 "2007-05-14T19:58:42Z")

</div>

Ronald F. wrote:

> Thank you for helping, though… I wonder whether there is a specific  
> mailing  
> list devoted to compatibility issues between Ruby and JRuby. Right now,  
> I’m  
> doing a lot of trial and error, to find out what Ruby stuff happens to  
> work  
> under JRuby.

Really the biggest incompatibility is anything that has a native  
extension. So if you go to install a gem and it gives you options for  
what platform to install, chances are it’s not going to work.

But Ruby language features should generally be very solid, and pure-Ruby  
code should be just fine. So if net-ssh isn’t working (or is it needle?)  
then it’s a bug we will want to fix. Can you report it please?

(and the JRuby mailing lists are the best place to talk about  
incompatibilities and stuff…I see from your other thread you’ve now  
joined 🙂

- Charlie

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [May 15, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/jruby-does-not-find-installed-gem/104101/6 "2007-05-15T12:36:19Z")

</div>

> Really the biggest incompatibility is anything that has a native  
> extension. So if you go to install a gem and it gives you options for  
> what platform to install, chances are it’s not going to work.
> 
> But Ruby language features should generally be very solid,  
> and pure-Ruby  
> code should be just fine. So if net-ssh isn’t working (or is  
> it needle?)  
> then it’s a bug we will want to fix. Can you report it please?

I created a new issue on the JRUBY project. My user id there is “rovf”,  
in case you need to look it up.

> (and the JRuby mailing lists are the best place to talk about  
> incompatibilities and stuff…I see from your other thread you’ve now  
> joined 🙂

Yes, it finally worked. I will post future messages specific to JRuby on  
that list.

Thank you for all the help.

Ronald
