But how do I achieve the same through
com.sun.script.jruby.JRubyScriptEngine interface? I do not see anyway I
could wrap the object to be usable on Ruby side?
Thanks Pawel and Aaron. That helped. I was prefixing $ in the name when
calling setAttribute. Your example snippets showed that I should remove
the $ prefix.
Related query: How do I supply RUBYLIB path to the JRubyScriptEngine
instance? Also how do I supply environment variables to the same
instance?
Do You mean standard jruby libraries by rubylib?
If so just add jruby_home to classpath.
As for environment variables maybe the same way as root variable will
do the job.
Do You mean standard jruby libraries by rubylib?
If so just add jruby_home to classpath.
As for environment variables maybe the same way as root variable will
do the job.
Pawel,
I mean user has a own Ruby library, and wants to run a script which uses
this library. Now I need to create the ScriptEngine inside the server
JVM which would evaluate the script. But the ScriptEngine would have no
knowledge of the user Ruby library. So they need to provide something
like what RUBYLIB does to standalone Ruby interpreter.
I guess the ScriptContext injects global variables, and does not set the
ENV hash.
[“jruby-openssl-0.2.3”].each do |lib|
path = “#{ROOT}/lib/#{lib}/lib”
$LOAD_PATH.unshift(File.expand_path(path))
end
it loads jruby-openssl but i don’t know exactly how it works,
i’m not the author of that snippet,
ROOT is the base directory of where additional libraries are located
but what is LOAD_PATH i don’t know for sure.
I think it should work like in normal ruby script anyway.
If You won’t manage send me an info so i will ask author of that code.
Best greetings,
Paweł Wielgus.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.