(Crossposting note: I’ve now posted this question at
too, after not having received any response here)
I’m on Windows, with JRuby 1.7.23 (but I think this doesn’t matter for
this question).
My project directory has the following subdirectories:
- javas (contains the Java source files)
- rubies (contains the Ruby source files)
- gem (contains my gems)
That is, my gem directory is not a standard place.
I install the gems with
jruby -S gem install GEMNAME --install-dir ./gem
and set the environment variable GEM_HOME to my ./gem directory
If I had a pure JRuby application, it would find my installed gems. The
problem is that it is a mixed Java application. I’m creating my jar file
like this:
jar cvfm app.jar manifest.mf -C . Main.class javas*.class rubies
gem\gems*
which, as I can see, nicely packs my gems into the jar file. When I run
my application with
java -cp c:\jruby\jruby.jar;app.jar Main
I get an exception when I require one of my installed gems, which is not
surprising, because GEM_HOME doesn’t have any meaning when the
application is run from the jar file, does it?
What is the best approach in this case? Should I explicitly manipulate
the $LOAD_PATH, and if yes, how?
================================================
Problem solved! For the solution, have a look at the Stackoverflow link
mentioned above.