Status of Ruby<->Java Interfaces

J

Jeff

Hi,

I have a Java program that I'd like to access with Ruby, and I'm
looking for the 'right tool for the job'. The Java program is an API
collection of classes that implement a network/socket protocol, and
I'd like to find a way to have Ruby make the calls, e.g.
Java:
public class MySocket {
private Socket m_socket; // the socket
private DataOutputStream m_dos; // the socket
output stream
/////more stuff here....
private void send( String str) throws IOException {
m_dos.write( str.getBytes() );
m_dos.write( EOL);
}
}

and I'd like to be able to do something like:
Ruby:
mysock=Java.Class.MySockect.new (or something along these lines)
mysock.send("Hello there")

So what is the state of the world with the various options that exist
in Ruby for this sort of thing? I've had a brief look at rjni, rjava
and rjb. Each of which seem to be quite 'alpha'. Any comments,
suggestions on which is best? Any other options in terms of design?
Will these work with network/socket classes in Java?

Thanks in advance!
Jeff
 
J

James Edward Gray II

So what is the state of the world with the various options that exist
in Ruby for this sort of thing? I've had a brief look at rjni, rjava
and rjb. Each of which seem to be quite 'alpha'. Any comments,
suggestions on which is best? Any other options in terms of design?
Will these work with network/socket classes in Java?

I have know experience with any Java <-> Ruby bridges, but sine I know
it exists and I didn't see you mention it, have you checked out JRuby?
Just a thought.

James Edward Gray II
 
M

Mauricio Fernández

rjb is the only one actively developed atm., so it's probably the best
option.

I stopped working on rjni when I discovered that the JVM was interacting
with the signals ruby uses to implement threads (so that Ruby threads
wouldn't work) and realized that the non-reentrancy of ruby 1.x made
this all quite hard...
Each of which seem to be quite 'alpha'. Any comments,

The main problem would be when you have multiple Java threads; that's
hard to handle in 1.x, at least if you're using JNI directly.
 
R

Randy W. Sims

Hi,

I have a Java program that I'd like to access with Ruby, and I'm
looking for the 'right tool for the job'. The Java program is an API
collection of classes that implement a network/socket protocol, and
I'd like to find a way to have Ruby make the calls, e.g.

Is there any particular reason you can't use the ruby sockets interface
in this case?

Randy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top