简体   繁体   中英

Installing gems on jruby

I've worked with ruby, and ROR but this new project is requiring me to use jruby. And I have been given documentation ad it is asking me to install jgem install cucumber, ect..

I am doing this on Ubuntu 10.10

I don't understand the jgem part.

I Did some research and tried to install it via: jruby -S gem install cucumber

and got the output:

JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
ERROR:  While executing gem ... (SystemCallError)
    Unknown error - mkdir failed

And I tried to install: gem install jruby-openssl and got the same results

These are the steps showing how to pack bio and jruby-openssl into jruby-complete-1.6.7.jar becoming biojruby.jar (just for my purpose, I need bioruby for developing bioinformatics programs)

Here are the steps:

  • Make sure you navigated into the directory containing jruby-complete-1.6.7.jar in terminal/console

  • In terminal/console, type in:

     mkdir biojruby 
  • Just add any gems you want, for gems which written purely in ruby without any C extension will work in Jruby!

     java -jar jruby-complete-1.6.7.jar -S gem install -i ./biojruby bio java -jar jruby-complete-1.6.7.jar -S gem install -i ./biojruby jruby-openssl jar uf jruby-complete-1.6.7.jar -C biojruby . mv jruby-complete-1.6.7.jar biojruby.jar 
  • Now you can remove the folder "biojruby"

  • Completed!

Now type in:

java -jar biojruby.jar -S gem list

and you will see (indicate success):

**** LOCAL GEMS ***
bio (1.4.2)
bouncy-castle-java (1.5.0146.1)
jruby-openssl (0.7.6.1)
rake (0.8.7)
sources (0.0.1)*

Now you can test with your ruby script by type in:

java -jar biojruby.jar #Your_Ruby_Script.rb#

It sounds strange, how have you installed JRuby? With RVM?

If you use rvm it's super easy to install and use jruby like every others ruby implementation.

rvm install jruby
rvm use jruby

jruby -v
gem install jruby-openssl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM