Can JRuby invoke Java APIs?

…yes…their web site doesn’t say much…
… I don’t know…but it might be pretty powerfull to be able to use
Swing or some of the many libraries which have been written for java if the
syntax is not too awkward. …but doesn’t CORBA provide some
mechanism for inter-object communication ?? If ruby can talk to CORBA
then maybe you could have a java process that provides the services you
need ??? For that matter… [ opening my book of wishes ] …wouldn’t
it be cool if we could implement the parts of
what we need in whatever language and then just compile it, and have it all
work together. I think you can do some of that via pipes or sockets
… ie … a ruby process listening on a socket for data ( XML
data ?) and a COBOL or Java process sending data out from the other side
? I have never done that, but it does not seem far fetched.

Sincerely,
Greg

                <jrefactor@hot                                                          
                mail.com>            To:     <ruby-talk@ruby-lang.org>                  
                                     cc:                                                
                11/08/02 04:51       Subject:     Can JRuby invoke Java APIs??          
                AM                                                                      
                Please respond                                                          
                to ruby-talk                                                            

Can JRuby invoke Java APIs?? For example, if I want to invoke Ruby
scripts from Java application. And the Ruby script will invoke Java
APIs, is it possible??
For example, Beanshell script is able to do that. Thanks.

Not sure if Ruby is a java scripting language

you can access swing with JRuby.
refer to the samples of JRuby.

regards,
Alia

snip

… I don’t know…but it might be pretty powerfull to be able to use
Swing or some of the many libraries which have been written for java if the
syntax is not too awkward. …but doesn’t CORBA provide some

snip

GBanschbach@sandata.com writes:

…yes…their web site doesn’t say much… … I don’t
know…but it might be pretty powerfull to be able to use Swing or
some of the many libraries which have been written for java if the
syntax is not too awkward.

Here’s the Swing example from the JRuby download:

require 'java'

module Swing
  include_package "javax.swing"
end

frame = Swing::JFrame.new("Hello Swing")
label = Swing::JLabel.new("Hello World")

frame.getContentPane().add(label)
frame.setDefaultCloseOperation(Swing::JFrame::EXIT_ON_CLOSE)
frame.pack();
frame.setVisible(true);

Cheers

Dave