Running JRuby

Im trying to set up java and jruby on Windows, great work with the
recent developments.

In some of the recent examples of irb running on jruby it is ran like:

C:\rails>jruby C:\ruby\bin\irb

If I run this I get:

c:\ruby\bin\irb:10:in ‘require’: No such file to load – irb (LoadError)
from c:\ruby\bin\irb:10"

I have set both JAVA_HOME and JRUBY_HOME.

Many thanks, Pete.

PS. When setting JRUBY_HOME enviroment var it appears it cant have any
spaces in the path, this is on Windows. And is most likly something to
do this ‘DOS’.

JRuby does not provide its own set of .rb libraries to run off; it
expects that you will have C Ruby available somewhere. Obviously this
allows us to run 90% of Ruby code and libraries exactly as C Ruby
does, since we both use the same .rb files. I believe you have two
options:

  1. Try setting RUBY_HOME to the base directory of your C Ruby install
    (i.e. where you would find bin, lib, and so on). The JRuby startup
    script should be able to see that location and use the .rb files
    directly.
  2. If that fails to work (let me know!), you can simply copy the C
    Ruby .rb files into the JRuby distribution directory:
  • copy %RUBY_HOME%\lib\ruby\1.8 directory as a whole into
    %JRUBY_HOME%\lib\ruby, so you have %JRUBY_HOME%\lib\ruby\1.8
    containing all the same files.

The second method is how most of the JRuby dev team runs JRuby, and it
works very well. It also keeps JRuby separate from your Ruby install,
so if you move or rename it JRuby will continue to work. It does,
however, require to you update those libraries if you install a newer
Ruby version. In the future, we hope to work out a way to distribute
JRuby with the standard Ruby .rb files, so it provides a complete,
working Ruby interpreter out-of-the-box…but that’s a discussion for
another day.

JRuby also has a user mailing list on sf.net/jruby, the jruby-user
list. Please join us and let us know if you have any more problems.
Thank you for trying JRuby!

Sorry, that’s JRuby download | SourceForge.net, and I should probably be plugging
jruby.sf.net instead, since that’s the official home page. Sorry for
the mixup!