How do I add something to the classpath in a JRuby on Rails app?

I’m reading a tutorial which tells me to download an sdk and add its bin
directory ‘to my path’. I’m not sure how to do this, or what it means.
Could someone please provide an explanation to a newbie?

Bump for help!

I’ve tried adding this to config/environment.rb

require ‘java’
$CLASSPATH << “lib/sdk/bin/”

and I’ve tried a few different combinations of this but it doesn’t seem
to work.

I think maybe I just don’t really understand what the CLASSPATH is
exactly… is it a property of the system, or the app? Any help or an
explanation would be appreciated!

I believe they are just asking you to add the bin to the path so it is
available in your users shell.
E.g. If I want to add all of the commands from an SDK to my users unix
PATH I can do this:

$> export PATH=$PATH:/usr/lib/sdk/bin

Then when I try to auto-complete or execute a command they will be
available to my current shell. How do you anticipate using this SDK from
your Ruby program? Do you want to execute the program using Kernel? e.g.
compiler a.file

Ariel V.
e-mail: [email protected]
skype: ariel.s.valentin
twitter: arielvalentin
linkedin: Sign Up | LinkedIn

*simplicity *communication
*feedback *courage *respect

Yes I think that was it. Thanks.

That looks a little strange to me…the CLASSPATH is intended to contain
jar files or directories that contain Java code, not system executables.

And when you say it doesn’t work, what do you mean exactly? Do you get
an error message, and if so, can you post it?

  • Keith

Keith R. Bennett