On Tue, Feb 9, 2010 at 11:49 PM, Silvester <[email protected]> wrote:
>
> I have written the below code in Java using JRuby API. (http://
> kenai.com/projects/jruby/pages/RedBridge)
>
> ..............
> private final static String jrubyhome = "C:/Program Files/
> jruby-1.4.0";
> private final String filename = jrubyhome+"/lib/ruby/gems/1.8/gems/
> ruote-2.1.6/examples/ruote_quickstart.rb";
>
> public static void main(String[] args)
> {
> ScriptingContainer container = new ScriptingContainer();
> List<String> loadPaths = new ArrayList();
> loadPaths.add(jrubyhome);
> loadPaths.add(jrubyhome + "/lib/ruby/site_ruby/1.8");
> loadPaths.add(jrubyhome + "/lib/ruby/1.9");
> loadPaths.add(jrubyhome + "/lib/ruby/gems/1.8/gems/ruote-2.1.6/lib");
> loadPaths.add(jrubyhome + "/lib/ruby/gems/1.8/gems/rufus-json-0.2.0/
> lib");
> loadPaths.add(jrubyhome + "/lib/ruby/gems/1.8/gems/rufus-json-0.2.0/
> lib/rufus");
> loadPaths.add(jrubyhome + "/lib/ruby/gems/1.8/gems/rufus-
> cloche-0.1.13/lib");
> loadPaths.add(jrubyhome + "/lib/ruby/gems/1.8/gems/rufus-
> scheduler-2.0.3/lib");
> container.getProvider().setLoadPaths(loadPaths);
> container.runScriptlet(PathType.ABSOLUTE, filename);
> }
Hi, sorry for the late reply,
this is super complicated. It shouldn't be that complicated. You
should be able to tell JRuby directly what libraries you want to load.
For example, you can directly run this :
---8<---
require 'rubygems'
require 'ruote'
def generate_definition (name, tasks)
Ruote.process_definition :name => name do
tasks.each do |t|
participant :ref => 'x', :task => t
end
end
end
p generate_definition('a', [ 'sending season cards', 'clean garage' ])
--->8---
$ jruby myfile.rb
The first line requires 'rubygems' and then loadpaths are managed for
you. No need for all this work.
Maybe your context is different, but there shouldn't be no need to
hardcode all of this.
> But the script line "storage = Ruote::FsStorage.new('ruote_work') "
> throws the runtime error."no JSON backend found".
>
> Am i missing any steps? Your help is greatly appreciated.
Yes, there is a missing step, you need to load a JSON backend before
requiring/loading rufus-json.
On JRuby the best one currently is 'json-jruby'
jruby -Sgem install json-jruby
Then, as said, you have to make sure that json-jruby is
loaded/required before rufus-json, so that rufus-json detects it.
(commercial break : I'm using the amazing RVM
http://rvm.beginrescueend.com by Wayne E. Seguin to manage all my
rubies, including JRuby, so that I only type
gem install json-jruby
)
Hope this will help, kind regards,
--
John Mettraux - http://jmettraux.wordpress.com
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en