June 20, 2008

Installing jRuby on Mac OS X

Posted by Sudhindra Rao

I was trying to install and run jruby on my mac(Jruby 1.1.2). After downloading and unzipping the installer I tried to run jruby.
But all I was getting was an exception


Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main

Googling did not yield anything useful.
So I started debugging and I found that the CLASSPATH had not been specified correctly in the
jruby file.
All I was getting was an empty string for the CLASSPATH which is why it was not able to find the jruby.jar(which contains the org.jruby.Main class)

To fix this I added

CLASSPATH=./../lib/jruby.jar

before CLASSPATH was being used in the jruby file.

Looks like CLASSPATH has not been defined in the jruby.bat file too. So jruby won't work on Windows either.

Hope this tip helps someone.

Welcome