Jabberwocky

Android and JRuby (1)

Posted in java, JRuby, mobile, ruby by elisehuard on January 8, 2009

Well, i’ve delved into it a little more – specifically i’ve watched presentation by Charles Nutter about the JRuby compiler, and tried to dx (transform the bytecode to fit the Dalvik Virtual Machine) a simple jruby compiled class.
jrubyc mvm.rb
dx --dex --output=mvm.dex mvm.class

I couldn’t actually test this (except performing a dump) on the virtual machine – something missing from the android toolset here, for as far as i could see.

(other interesting writeup about the DVM here)

I don’t really know much about compilers, but my intuition is that this might not work:

  • The compilation of JRuby code transforms the structure beyond recognition – lots of ‘method’s are created to compensate for Ruby’s dynamic nature. My impression is that Android expects certain predefined classes (Activity, Intent and whatnot) – extending those classes with JRuby might produce something totally different, and ultimately unuseable.
  • Even if it works, the use of Ruby might be severely constrained – no Ruby magic, weird inclusions etc. Actually, would there be a point to making this work at all ?

Anyhow, these are initial impressions. I’ll need to experiment with Android some more, and then test some with both (JRuby and android) toolsets. I might also be in over my head, and this might require language expert intervention. Live and learn, right ?

Advertisements
Tagged with: , ,

2 Responses

Subscribe to comments with RSS.

  1. Marc said, on January 8, 2009 at 5:47 pm

    The cool thing is that it’s the Android SDK which “expects” a certain structure. Dalvik doesn’t. As soon as you get jruby to compile to dalvik bytecode instead of java bytecode you would be able to start doing simple “Hello World” stuff which would certainly be a start πŸ™‚

  2. elisehuard said, on January 8, 2009 at 7:32 pm

    I’m aware of this – however, the whole idea is to run something on the Android platform πŸ™‚
    otherwise, there isn’t much point (except theoretical interest maybe)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: