Forum: Ruby What would you like to know about JRuby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Charles Oliver N. (Guest)
on 2008-11-04 22:54
(Received via mailing list)
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. (Guest)
on 2008-11-04 23:19
(Received via mailing list)
From: "Charles Oliver N." <removed_email_address@domain.invalid>
> - 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
Charles Oliver N. (Guest)
on 2008-11-05 00:26
(Received via mailing list)
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
James B. (Guest)
on 2008-11-05 03:00
(Received via mailing list)
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. (Guest)
on 2008-11-05 03:28
(Received via mailing list)
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
James B. (Guest)
on 2008-11-05 08:00
(Received via mailing list)
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
Roger P. (Guest)
on 2008-11-06 02:01
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 :)
-=R
Dick D. (Guest)
on 2008-11-18 15:29
(Received via mailing list)
On Tue, Nov 4, 2008 at 8:51 PM, Charles Oliver N.
<removed_email_address@domain.invalid> 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 :)
Charles Oliver N. (Guest)
on 2008-11-18 15:57
(Received via mailing list)
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 :)

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
Chris A. (Guest)
on 2008-11-19 01:21
(Received via mailing list)
On Tue, Nov 18, 2008 at 1:53 PM, Charles Oliver N.
<removed_email_address@domain.invalid> 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.
Charles Oliver N. (Guest)
on 2008-11-19 07:02
(Received via mailing list)
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
Maksim A. (Guest)
on 2008-11-19 10:30
(Received via mailing list)
On Nov 5, 2:51 am, Charles Oliver N. <removed_email_address@domain.invalid>
Maksim A. (Guest)
on 2008-11-19 10:35
(Received via mailing list)
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. <removed_email_address@domain.invalid>
Maksim A. (Guest)
on 2008-11-19 10:50
(Received via mailing list)
Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
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. (Guest)
on 2008-11-19 10:51
(Received via mailing list)
Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.
Charles Oliver N. (Guest)
on 2008-11-19 15:01
(Received via mailing list)
Maksim A. wrote:
> Oh, sorry. Rubyconf is over, I have not looked at the date of the
> first message, shame on me :)
> 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 :) The talk should be published soon, but I can answer this
question here too.

> On Nov 19, 2:31 pm, Maksim A. <removed_email_address@domain.invalid> 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
List R. (Guest)
on 2008-11-19 21:45
(Received via mailing list)
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.
<removed_email_address@domain.invalid
Charles Oliver N. (Guest)
on 2008-11-20 09:08
(Received via mailing list)
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.
Maksim A. (Guest)
on 2008-11-20 16:35
(Received via mailing list)
Charles, thanks a lot for your insightful description.
That's exact kind of overview I was looking for.


On Nov 19, 6:57 pm, Charles Oliver N. <removed_email_address@domain.invalid>
Nathan (Guest)
on 2009-08-20 02:31
(Received via mailing list)
On 2008-11-04 19:58:22 -0500, James B. <removed_email_address@domain.invalid> 
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.
Nick B. (Guest)
on 2009-08-20 06:43
I would be interested in hearing about JRuby on Google App Engine.
Charles N. (Guest)
on 2009-08-20 11:01
(Received via mailing list)
I love that this thread is revived a year later :)

So far here's what we're hoping to show at RubyConf this year, if
we're accepted:

* Android support in JRuby
* "Real" Java class support, enabling things like Hibernate
* 2D and 3D games and game libraries
* Desktop app development using various frameworks
* Cloud deployments a la GAE and EY Cloud
* Maybe a quick feature roundup, including FFI, 1.9 support, etc
* New, cooler Java scripting demonstrations, like the MIDI library stuff
* New compiler work for better Java integration and improved performance
* Integration with other JVM languages like Clojure and Scala
* Roundup of new JRuby users in the last year

There's too much to cover...so feel free to cast a vote here if
there's specific things you'd really like to hear about.

- Charlie
This topic is locked and can not be replied to.