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

Discussion in 'Ruby' started by Ronald Fischer, May 11, 2007.

  1. 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 <>
    Phone: +49-89-452133-162
    =20
    Ronald Fischer, May 11, 2007
    #1
    1. Advertising

  2. > 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
    Ronald Fischer, May 14, 2007
    #2
    1. Advertising

  3. Ronald Fischer

    Scott Miller Guest

    Re: Any JRUBY programmers out there? Problems specifying RUB

    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/.
    Scott Miller, May 16, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Danstron

    Are there ANY good forums out there anymore???

    Eric Danstron, Sep 21, 2005, in forum: ASP General
    Replies:
    1
    Views:
    135
    Immediacy
    Sep 22, 2005
  2. matthew c. mead

    passing RUBYLIB to fcgi processes

    matthew c. mead, Feb 15, 2004, in forum: Ruby
    Replies:
    0
    Views:
    87
    matthew c. mead
    Feb 15, 2004
  3. Richard Lionheart
    Replies:
    8
    Views:
    120
    Richard Lionheart
    May 27, 2004
  4. Chris Spiegel

    RubyGems and $RUBYLIB

    Chris Spiegel, Feb 28, 2005, in forum: Ruby
    Replies:
    0
    Views:
    133
    Chris Spiegel
    Feb 28, 2005
  5. aurelianito

    RUBYLIB on Windows

    aurelianito, Nov 4, 2005, in forum: Ruby
    Replies:
    4
    Views:
    272
    aurelianito
    Nov 4, 2005
Loading...

Share This Page