Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Any JRUBY programmers out there? Problems specifying RUBYLIB with jruby.

Reply
Thread Tools

Any JRUBY programmers out there? Problems specifying RUBYLIB with jruby.

 
 
Ronald Fischer
Guest
Posts: n/a
 
      05-11-2007
I would like to run jruby on either pure Windows, or Cygwin. This works
fine as long as I
only use the standard library which comes with jruby. I can't make it,
however, search
additional libraries I have put in non-standard places. For example, I
have a Ruby module
placed in ....\SOMEPATH\lib\net\ssh, which I require from my Ruby
program by

require 'net/ssh'=20

I guess I have now to set my RUBYLIB environment variable, so that jruby
can resolve the
require statement. I tried several possible variations of how to set
RUBYLIB, but always
get a "no such file to load".=20

For example under cygwin (bash shell), even a

cd SOMEPATH # go to the directory containing the library
RUBYLIB=3D. jruby MYPROGRAM.rb

or

RUBYLIB=3Dlib jruby MYPROGRAM.rb

does not find the library. And in a Windows command shell,

set RUBYLIB=3D....\SOMEPATH\lib\net\ssh

or, respectively,

set RUBYLIB=3D....\SOMEPATH\lib\net\ssh\lib

doesn't make jruby find the library either.

I would already be glad finding a solution for either Windows or Cygwin,
but of
course being able to get it running under both would be even better. I
understand
that doing it for Cygwin is trickier though, because Jruby is based on
Java and
hence doesn't understand Cygwin pathes.

Ronald

--=20
Ronald Fischer <(E-Mail Removed)>
Phone: +49-89-452133-162
=20

 
Reply With Quote
 
 
 
 
Ronald Fischer
Guest
Posts: n/a
 
      05-14-2007
> Ok, what you should do here is not use RUBYLIB at all. JRuby does=20
> understand RUBYLIB, but it won't do what you expect. Instead,=20
> use the -I=20
> parameter to JRuby:
>=20
> jruby -I lib MYPROGRAM.rb
>=20
> This will work just fine on both Win32 and Cygwin.


Thank you very much.

Ronald

 
Reply With Quote
 
 
 
 
Scott Miller
Guest
Posts: n/a
 
      05-16-2007
I currently use RUBYLIB in a similar way. It's especially handy for
one-off command-line scripts:

bashrc -
export RUBYLIB=c:/cvs-main/db-building/scripts

...

ruby -e "require 'lsml'; $p.parse{ |r| r.ids.each {|id| if id.type ==
'reg' then puts id end}}" file.xml

where the lsml library has a bunch of pre-canned tools set up. It would
be a drag to have to specify -I ... every time.

The problem I ran into with jruby is that it doesn't know about the
cygwin mounts (/cygdrive/c/) and splits on ":" instead of ";" - which
makes the c:/ notation problematic. (Incidentally, the cygwin ruby
handles both ; and : in RUBYLIB)

I posted a fix to jira - where it uses File.pathSeparator instead of :,
and have been happy ever since.

http://jira.codehaus.org/browse/JRUBY-938


Ola - I'm left curious as to what RUBYLIB is supposed to do, if not
handle this case, and if so, is there another (perhaps more appropriate)
way to do what I'm suggesting?

Thanks,
Scott

Ronald Fischer wrote:
>> Ok, what you should do here is not use RUBYLIB at all. JRuby does
>> understand RUBYLIB, but it won't do what you expect. Instead,
>> use the -I
>> parameter to JRuby:
>>
>> jruby -I lib MYPROGRAM.rb
>>
>> This will work just fine on both Win32 and Cygwin.

>
> Thank you very much.
>
> Ronald



--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JRuby on Android (from: What would you like to know about Jruby?) Florian Gilcher Ruby 3 11-20-2008 07:02 AM
JRubyHub.com: The hub to all JRuby and JRuby on Rails (JRoR)resources... sbaltagi@gmail.com Ruby 0 12-15-2007 07:28 PM
JRubyHub.com: The hub to all JRuby and JRuby on Rails (JRoR)resources... Slim Baltagi Java 0 12-15-2007 07:26 PM
[ANN] [JRuby] Fast Debugger for JRuby Martin Krauskopf Ruby 0 11-11-2007 10:47 PM
[JRuby] JRuby perf questions answered Charles Oliver Nutter Ruby 7 11-01-2007 05:11 AM



Advertisments