After building JRuby and installing Rails, when I run “jruby -v” the
following version is reported: ruby 1.8.5 (2007-10-15 rev 3876)
Also, I have read http://headius.blogspot.com/2006/03/ruby-in-rough.html
which tells me that JRuby always sets the platform to “java”.
Unfortunately, this way there is no indication whether I run JRuby on a
Windows or any other platform. This shouldn’t really matter, because
Java is platform independent, but in the case of rails (or at least when
I want to start the server), it does matter. Otherwise starting the
server would give me:
realpath_rec': No such file or directory - C: (Errno::ENOENT) from C:/Programme/Java/jruby/lib/ruby/1.8/pathname.rb:453:inrealpath’
set_root_path!' from C:/Programme/Java/jruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/initializ er.rb:509:ininitialize’
new' from ./script/../config/boot.rb:38:inrun’
run' from script\server:2:inrequire’
from script\server:2:in `require’
To make it work, I had to force the following function to properly
identify my platform as Windows.
def set_root_path! raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT) raise 'RAILS_ROOT is not a directory' unless
@root_path = # Pathname is incompatible with Windows, but Windows doesn't
# real symlinks so File.expand_path is safe.
if RUBY_PLATFORM =~ /(:?mswin|mingw|java)/
# Otherwise use Pathname#realpath which respects symlinks. else Pathname.new(::RAILS_ROOT).realpath.to_s end end
I know that this is not a solution, just a work-around.