tags:

views:

31

answers:

1

Running the command jruby -S spec gives the following error

No such file, directory, or command -- spec

The location of spec is /usr/bin, which is in the path. Rspec is installed. MRI Ruby can find the script. JRuby can find the rspec gem. So what goes wrong?

+1  A: 

JRuby will try to load scripts from directories on the classpath. You can see what these are by running:

jruby -e "puts $:"

On the command line you can modify the $LOAD_PATH with the -I option. Or add a library with the -r option. For example:

jruby -I/usr/bin spec

Here is some more info on loadpath and classpath:

http://kenai.com/projects/jruby/pages/ClasspathAndLoadPath

Hope that helps

joekutner
That doesn't work, /usr/bin is not in the load path, nor should it be. - I'm using the -S option which is supposed to look at the PATH environment variable - but it doesn't.
Michiel de Mare
Apparently, `jruby -S` only looks in `$JRUBY_HOME/bin`, not in the PATH, although the docs say it does look in PATH.
Michiel de Mare
`cp /usr/bin/spec ~/git/jruby/bin` and it works, but this is really a band-aid solution.
Michiel de Mare