On Wed, 04 Nov 2009 18:43:21 +0200, Simon Chiang
<
simon.a.chiang@...> wrote:
> So how can I set java.library.path within my script so I don't need the
> command line flag?
I don't think you can. Like many other system properties (e.g.
java.class.path), the jvm copies the value at startup and ignores any
changes thereafter. There's nothing jruby can do about it.
> No luck so far. Any ideas? Thanks.
These things come to mind:
Add the folder containing the native library to PATH (if on windows) or
to LD_LIBRARY_PATH (e.g. linux, solaris) before launching your script.
Make a short shell script to launch your script.
As a variation of this, you could make your ruby script spawn a copy of
itself in a new process if it notices java.library.path does not contain
the folder you want (setting java.library.path correctly for the new
process, naturally). Note that there are some subtleties about launching a
new jruby process from jruby (IIRC there's an optimization that prevents a
new process from being created and instead runs the script in the same
process) - others more knowledgeable can comment more on this.
::Antti::
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email