1

I have installed all 3 of Ruby, JRuby, and Java on my machine. The problem is that they are all living kind of separately :)

How can I, in the same application, have Ruby invoke JRuby so that it calls the Java code and gets back some values?

Currently I am developing Ruby and deploying it to the default localhost:3000 but to call the Java classes, I probably need to consolidate all this into a Tomcat .war file. In turn, the Java code is built and deployed using an ant script.

What is the best way for me to go about consolidating all that into one application?

2
  • Can you give an example or code sample of how your Ruby invokes JRuby? Commented Apr 26, 2011 at 5:39
  • Jruby already contain RUBY Commented Feb 26, 2024 at 6:59

1 Answer 1

1

The easiest approach would be to move everything into JRuby, and package it with warbler.

Sign up to request clarification or add additional context in comments.

4 Comments

Is there a disadvantage to having the Ruby --> JRuby approach? I think I like the flexibility of having the UI be in Ruby so that there is less mis-compatibility with random gems.
having to make a call to JRuby is a disadvantage, not being able to make a war with warbler, too. Being JRuby means running in one JVM, being able to call Java from JRuby and JRuby from Java. I would say it makes life much easier.
If you're relying on native gem extensions, then things can get fiddly, but otherwise JRuby is at least as reasonable a choice of interpreter as MRI at this point.
I mean, if I just stick to JRuby, will I be able to easily make use of the UI plugins available for Ruby? They are usually just gems, right? Will I be able to use them transparently?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.