John Davis wrote:
> I have trouble to invoke Ruby scripts in Java applications
> 
> The following didn't work
> > Ruby runtime = Ruby.getDefaultInstance(null);
> > runtime.evalScript("puts 'hello'");

Didn't work *how*?

> any examples????

No. :)

> Runtime.getRuntime().exec("jruby test.rb"); //didn't work either, no output
> 
> //test.rb
> puts 'hello'

First of all, can you run "jruby test.rb" from the command line? If that
doesn't work, there is no point in trying to do the same from within an
application.
But if your application is a Java application you will have more success
using JRuby directly, instead of running it as a separate program (as
you do with exec() ).

> So basically Ruby doesn't support Java. i.e. Ruby language can't invoke Java
> API

Ruby doesn't support Java any more than that it can launch Java
applications, just like it can launch any kind of program. *JRuby*
however, can directly access Java objects.

You can find out more about JRuby at <http://jruby.sourceforge.net/>,
where you can also find the "jruby-user" mailing list.

/Anders
-- 

A n d e r s  B e n g t s s o n  |  ndrsbngtssn / yahoo.se
Stockholm, Sweden               |

_____________________________________________________
Gratis e-mail resten av livet p? www.yahoo.se/mail
Busenkelt!