Hello, everyone As i know, there are 2 ways to integrate java code in jruby 1. call java code directly in jruby 2. write a java extension for jruby What difference between them and which is the better way to integrate java code? thanks
on 2011-12-28 02:48
on 2011-12-28 03:42
Your question is too broad and unclear to answer properly. If you want to reuse Java classes, you need to "require 'java'" and then require whatever Java staff you want: http://blogs.oracle.com/coolstuff/entry/using_java_classes_in_jruby or http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby#Accessing_and_Importing_Java_Classes If you want to run Ruby code from existing Java application then you can use RedBridge: http://kenai.com/projects/jruby/pages/RedBridge#Getting_Started
on 2011-12-28 06:52
On Wed, Dec 28, 2011 at 10:41 AM, Dmytrii Nagirniak <dnagir@gmail.com> wrote: > Your question is too broad and unclear to answer properly. > > If you want to reuse Java classes, you need to "require 'java'" and then > require whatever Java staff you want: > http://blogs.oracle.com/coolstuff/entry/using_java_classes_in_jruby > or > http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby#Accessing_and_Importing_Java_Classes > Thanks. Yes, i want to reuse Java classes in JRuby code. I think there are 2 ways to do this. one is using 'require java' and the other is writing a JRuby extension using java. I want to know the difference of them
on 2011-12-28 13:46
I think you should review Dmytrii's links (although I think the wiki pages have moved to GitHub, see below). The pages do a pretty good job of explaining what purposes they serve. If you're in Java-land and want to call into JRuby or enable a scripting environment like JRuby to be run *from Java*, RedBridge is what you're looking for. If you want to call Java *from JRuby*, that's pretty easy with the require 'java' piece. The only real difference between the two is from which side of the fence you're looking at the integration. Embedding JRuby in Java - https://github.com/jruby/jruby/wiki/RedBridge Calling Java from JRuby - https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby -Nick Klauer
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.