O'Reilly logo

Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java™ Platform by Ola Bini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX BJRuby Reference

This appendix will serve as a reference when using pure JRuby features. All these features (except for the JRuby module) are only available after executing this:

require 'java'

This happens automatically if you reference the module named Java, though. Chapter 6 also covers the information in this appendix, with much more information and detail, when that is needed.

Classes and Interfaces

It's easy to use Java classes and interfaces from JRuby, as we've seen through the book.

Referencing a Java Class or Java Interface

To reference a Java class in the java, javax, com, and org packages, you can use top-level references:

com.foo.Bar java.util.HashMap org.jruby.Main

When working with a class in another package, use the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required