What would you like to know about JRuby?

Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there’s just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

  • Rails (or Merb, Rack, etc) deployment
  • Performance
  • Java integration (calling Java libraries)
  • FFI
  • Ruby 1.9 support
  • General compatibility
  • How to help or contribute
  • Technical/implementation details
  • GUI development (there’s also a MonkeyBars talk already)
  • Graphics/game development

Others?

Hopefully the talks will be recorded as well, so those of you not at
RubyConf can see it too.

  • Charlie

Bill K. wrote:

Applets?

  • are applets supported? work OK or problematic?
  • what’s the minimum or typical jar file size to get a reasonable jruby
    runtime in an applet?

Yeah, good idea. How about mobile too? We get a lot of questions about
whether JRuby could work on Android et al, and though we’re not working
on it it’s most definitely possible. I figure we could cover the current
state and possible future for both applets and mobile and give people
the step-by-step needed to make either work.

So much stuff we could include.

  • Charlie

From: “Charles Oliver N.” [email protected]

  • General compatibility
  • How to help or contribute
  • Technical/implementation details
  • GUI development (there’s also a MonkeyBars talk already)
  • Graphics/game development

Others?

Applets?

  • are applets supported? work OK or problematic?
  • what’s the minimum or typical jar file size to get a reasonable
    jruby runtime in an applet?

Thanks!

Bill

James B. wrote:

Indeed. I’d like to hear more about JRuby on the Web for non-Rails
apps. (I’ve been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)

Maybe there’s enough interest in JRuby practicalities that we should try
to pull together a hackfest and/or BOF? As I understand it there’s going
to be a lot of available rooms for that kind of thing. Anyone know how
BOFs and breakout rooms will be scheduled?

  • Charlie

Charles Oliver N. wrote:

the step-by-step needed to make either work.

So much stuff we could include.

Indeed. I’d like to hear more about JRuby on the Web for non-Rails
apps. (I’ve been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)


James B.

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff

Charles Oliver N. wrote:

Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there’s just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

I won’t be there but android support :slight_smile:
-=R

Charles Oliver N. wrote:

James B. wrote:

Indeed. I’d like to hear more about JRuby on the Web for non-Rails
apps. (I’ve been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)

Maybe there’s enough interest in JRuby practicalities that we should try
to pull together a hackfest and/or BOF?

That’d work. I plan on hacking on Wiimote-driven Monkeybars app
(excited that I just picked up a very nice wireless IR sensor bar).


James B.

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff

Dick D. wrote:

I’d like a few examples of embedding Ruby into JEE - Ola B.s book had some
stuff on writing an EJB in Ruby for example, I’ve seen OpenESB demos
with JRuby scripts
as objects in the workflow, etc.

The Net is full of Rails+AR+MySQL+Jruby walkthroughs, but I’m trying
to write a JRuby MBean
(so i can run Ruby code when my cluster changes state)
and Google is looking back at me pretty blankly, I can tell you :slight_smile:

There’s actually some work going on in the GlassFish team to make Ruby a
first-class citizen of the Java EE world, so you could actually just
define an MDB in Ruby or a Sesion Bean in Ruby and it would wire all
that up. As painful and ugly as that sounds…we’ve seen other APIs
become actually pretty nice with a little Ruby sprinkled on them, and
it’s an obvious way to start using it in an existing EE company.

For the moment though, we really just need to iron out the embedding
story. Three or four different APIs, all slightly different, all with
their own compatibility and migration stories. Not the best state of
affairs.

  • Charlie

On Tue, Nov 4, 2008 at 8:51 PM, Charles Oliver N.
[email protected] wrote:

  • How to help or contribute
  • Technical/implementation details
  • GUI development (there’s also a MonkeyBars talk already)
  • Graphics/game development

Others?

I’d like a few examples of embedding Ruby into JEE - Ola B.s book had
some
stuff on writing an EJB in Ruby for example, I’ve seen OpenESB demos
with JRuby scripts
as objects in the workflow, etc.

The Net is full of Rails+AR+MySQL+Jruby walkthroughs, but I’m trying
to write a JRuby MBean
(so i can run Ruby code when my cluster changes state)
and Google is looking back at me pretty blankly, I can tell you :slight_smile:

On Tue, Nov 18, 2008 at 1:53 PM, Charles Oliver N.
[email protected] wrote:

There’s actually some work going on in the GlassFish team to make Ruby a
first-class citizen of the Java EE world, so you could actually just define
an MDB in Ruby or a Sesion Bean in Ruby and it would wire all that up. As
painful and ugly as that sounds…we’ve seen other APIs become actually
pretty nice with a little Ruby sprinkled on them, and it’s an obvious way to
start using it in an existing EE company.

That sounds rather cool - do you have any pointers to more information?

I’ve actually chosen to get into J2EE for a new project based on the
ability to deploy both a Rails app and a JRuby MDB using the same app
together in Glassfish, and while it wasn’t that difficult (even for
this EE newb), it’s far from just writing some Ruby. If there was
something like the equivalent of Warbler for beans, that would be
ideal.

Chris.

On Nov 5, 2:51 am, Charles Oliver N. [email protected]

I would greatly appreciate some general overview of the internals. Are
ruby files compiled into bytecode and then executed or java is invoked
to execute code line by line. If the first option is possible how do
you handle dynamic typing issues. Are any code optimizations applied
to ruby code?

Thanks

On Nov 19, 10:58 am, Charles Oliver N. [email protected]

Chris A. wrote:

That sounds rather cool - do you have any pointers to more information?

I’ve actually chosen to get into J2EE for a new project based on the
ability to deploy both a Rails app and a JRuby MDB using the same app
together in Glassfish, and while it wasn’t that difficult (even for
this EE newb), it’s far from just writing some Ruby. If there was
something like the equivalent of Warbler for beans, that would be
ideal.

Ahh, yeah, a “Beaner” or something to package up Ruby + JRuby for EE
stuff. That’s a good idea.

I don’t have a link to it, since it’s more internal discussion at this
point. Asking on JRuby mailing list would probably produce some
discussion. I believe the idea is that you would just be able to
configure a Ruby script or class as the MDB, for example, and GF would
know how to spin up JRuby and get at it. Sorta like how Spring can wire
in Ruby components (though Spring still ships JRuby 1.0ish, now
basically EOLed).

  • Charlie

Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :slight_smile:
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :slight_smile:
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

Maksim A. wrote:

Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :slight_smile:
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

No problem :slight_smile: The talk should be published soon, but I can answer this
question here too.

On Nov 19, 2:31 pm, Maksim A. [email protected] wrote:

I would greatly appreciate some general overview of the internals. Are
ruby files compiled into bytecode and then executed or java is invoked
to execute code line by line. If the first option is possible how do
you handle dynamic typing issues. Are any code optimizations applied
to ruby code?

JRuby is a mixed-mode implementation. We have both an interpreter that
walks the Ruby AST, just like Ruby 1.8 (though quite a bit faster), and
a compiler that turns Ruby into JVM bytecode. You can run all
interpreted, all compiled, or allow us to compile code just-in-time
(JIT) as the application runs. You can also compile all code
ahead-of-time (AOT) and ship .class files.

The compiled bytecode, however, is not exactly like a typical Java
class. Because Ruby’s class structures are very fluid, we do not (can
not) present a normal Java type. So the compilation is solely to create
“bytecode chunks” that will be executed independently as method, block,
and class bodies. The .class that results from AOT compilation is
basically just a “blob of methods” that are wired up at runtime into
Ruby code bodies.

Is that clear?

Here’s an example of the methods that result from compiling a very
simple script into a .class. The name mangling shows that we’re using
these simply as blobs of bytecode:

[headius @ cnutter:~/projects/jruby]
$ cat foo.rb
class Foo
def bar
baz { }
end
end
[headius @ cnutter:~/projects/jruby]
$ javap foo
Compiled from “foo.rb”
public class foo extends org.jruby.ast.executable.AbstractScript{
public foo();
public static {};
public IRubyObject file(…);
public IRubyObject class_0$RUBY$Foo(…);
public IRubyObject method__1$RUBY$bar(…);
public IRubyObject block_0$RUBY$block(…);
public IRubyObject method__1$RUBY$bar(…);
public IRubyObject class_0$RUBY$Foo(…);
public IRubyObject file(…);
public IRubyObject load(…);
public static void main(java.lang.String[]);
}

The file methods correspond to the body of the script. The two
class_0$RUBY$Foo methods represent the class body. The
method__1$RUBY$bar methods are the body of the “bar” method. The
block_0$RUBY$block method is the body of the block. And finally the
load and main methods are used for loading this script as a library (via
require or load) and for executing it as a normal Java “main”,
respectively.

Generally, you don’t need to know about any of this to get the benefit
of JIT or AOT compilation in JRuby.

  • Charlie

Hey Charles, I often find myself writing jruby scripts in java just
for the code completion on the larger java packages I work with.

Do you think netbeans will support java-library code completion for
jruby at some point? Thanks and hope this isn’t off topic.

On Nov 19, 2008, at 7:57 AM, Charles Oliver N.
<[email protected]

I believe it is planned, but I don’t know the status. NB 6.5 largely
focused on bringing the set of features Ruby had in 6.1 up to speed on
other languages (Python, Groovy, JS). I expect that with that out of the
way, they’ll all start getting additional new features at the same rate.

FWIW, NetBeans 6.5 is out as of yesterday. Very nice so far.

On 2008-11-04 19:58:22 -0500, James B. [email protected] said:

state and possible future for both applets and mobile and give people
the step-by-step needed to make either work.

So much stuff we could include.

Indeed. I’d like to hear more about JRuby on the Web for non-Rails
apps. (I’ve been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)

I am very interested in rack app deployment to non-glassfish
environmets. JBoss, Tomcat, etc. I am setting up vm’s to test with
locally, but it’s an uphill battle for me.

I would be interested in hearing about JRuby on Google App Engine.