JRuby 1.4 Release Candidate 1 is now available (links to all JRuby 1.4 RC1 versions).

A look at the release notes for JRuby 1.4 RC1 shows a lot of improvements such as the Ruby 1.8.7 support and the new Java integration support discussed previously on InfoQ.



Windows users might like the new JRuby installers, available as .exe files from the JRuby 1.4 download location.



Developers who want to embed JRuby in their applications for scripting or simply use JRuby from Java code now have a new API to work with: "Red Bridge" or org.jruby.embed , a new embedding API which might replace JRuby's JavaEmbedUtils in a future JRuby version.

Yoko Harada, creator of Red Bridge, explains:

Having JRuby 1.4.0RC1, users might be confusing JRuby’s JavaEmbedUtils and Red Bridge, and which one they should use. Definitely, new users should use Red Bridge since it is easy to use and powerful. [..] Right now, JavaEmbedUtils as well as other embed related interfaces are on a discussion to seek how they can be obsolete. API of JavaEmbedUtils and others have been used in many packages including JRuby Rack, so making them obsolete would be influential.

Red Bridge fixes some problems with other embedding APIs, such as the problem of how to see local variables across different calls to JRuby. The documentation of the new org.jruby.embed.ScriptingContainer explains:

The third examples shows how to keep local variables across mutilple evalucations. This feature simulates BSF engine for JRuby. In terms of Ruby semantics, local variables should not survive after the evaluation has completed. Thus, this behavior is optional, and users need to specify LocalVariableBehvior.PERSISTENT when the container is instantiated.

An example:

ScriptingContainer container = new ScriptingContainer(LocalVariableBehavior.PERSISTENT); container.runScriptlet("p = 42"); container.runScriptlet("puts #{p}");

Without LocalVariableBehavior.PERSISTENT , the variable p would not be available in the second call to container.runScriptlet , thus requiring to use global variables instead of local ones for use cases like this.



Now's the time to try JRuby 1.4 RC1 and report any regressions so fixes can make it into the release.

Finally, everyone interested in what makes JRuby tick can read R.J. Lorimer's series on JRuby's internals, the latest article dives into the the JRuby JIT.