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: java.util.HashMap org.jruby.Main

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

Get Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java™ Platform now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.