Reputation: 4448
After doing some googling, I've concluded that I'm sorely uninformed of how JRuby and Gems relate to each other. I'm developing a program in JRuby in netbeans. I know that you can only gems that are purely written in Ruby within JRuby (I'm assuming that Gems that netbeans JRuby acquires are only these kinds of gems).
My question is, if I use a gem in my program will it deploy properly? The target computers will only have the Java JRE and no access to downloading JRuby or gems.
Should I avoid using gems altogether or will the gem be compiled into java bytecode as well or is there something else that I can do?
Upvotes: 1
Views: 63
Reputation: 26743
JRuby being a ruby implementation, you can indeed use gems just like you would with MRI.
The gems can be implemented in ruby, in which case the ruby code will be executed by JRuby and JIT’ed as needed just like your own JRuby code; in Java, in which case it is already Java bytecode; or even in C, as JRuby has C extension support, but their use is more “perilous”.
How you package the gems with your application very much depends on how you deploy it. You can copy them in a folder, and add that folder to the LOAD_PATH
. If you use libraries like warbler or rawr, they will package the gems along your app for you. If you use rails, you can also use bundler
just like you normally would with MRI.
Upvotes: 1