From: Brian Candler Date: 2010-10-20T20:21:59+09:00 Subject: Re: ruby and java Ruben Herman wrote in post #955658: > Josh Cheek wrote in post #955656: >> On Wed, Oct 20, 2010 at 1:32 AM, Ruben Herman >> wrote: >> >>> I have a .jar file and want to use some methods form this jar file in >>> ruby without using jruby. >>> can someone help me? >>> thank you! >>> >>> -- >>> Posted via http://www.ruby-forum.com/. >>> >>> >> Why don't you want to use JRuby? It's really straightforward, you can >> basically interact with the Java as if it were Ruby (except sometimes >> you >> have to help it figure out the typing). > > > I don't want to use Jruby because my ruby code will be use by a tool > that is based on ruby not jruby (sorry for my english). Then you'll have to start up an external jvm process (e.g. using IO.popen), and talk to some Java code over stdin/stdout or over a socket. You can't just "use some methods" directly. It may make more sense to run a separate jruby instance, because then you could talk from ruby to jruby using DRb. This should be easy, given that the target machine clearly already has a JVM. You may be able to migrate your existing ruby code to jruby; the main reason I can see for not doing this is if your ruby code uses C extensions. -- Posted via http://www.ruby-forum.com/.