Search code examples
rubyjruby

Add .class files path to JRuby run command line


I have 2 file in folder: ~/hello.rb and ~/help.rb. hello.rb requires help.rb. I have compiled them into ~/build/ folder with:

jrubyc -t build/ .

When i run hello.rb with jruby, jruby searches for help.class in ~/, but I want to tell it to look in ~/build/ folder. How can I do it?


Solution

  • Not quite sure what you're trying to do, but this seems to be what you're asking...

    require 'build/help'
    

    Alternatively, us the -I switch to include a path at run time:

    jruby -Ibuild hello.rb