JRuby Cookbook


If you're interested in JRuby, you probably don't need a turorial on Ruby, Rails, or Java — you just need to know how to get things done. This Cookbook offers practical solutions for using the Java implementation of the Ruby language, with targeted recipes for deploying Rails web applications on Java servers, integrating JRuby code with Java technologies, developing JRuby desktop applications with Java toolkits, and more. Using numerous reusable code samples, JRuby Cookbook ...

See more details below
Other sellers (Paperback)
  • All (25) from $1.99   
  • New (11) from $8.50   
  • Used (14) from $1.99   
JRuby Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 44%)$27.99 List Price


If you're interested in JRuby, you probably don't need a turorial on Ruby, Rails, or Java — you just need to know how to get things done. This Cookbook offers practical solutions for using the Java implementation of the Ruby language, with targeted recipes for deploying Rails web applications on Java servers, integrating JRuby code with Java technologies, developing JRuby desktop applications with Java toolkits, and more. Using numerous reusable code samples, JRuby Cookbook shows you how to:

  • Install and update JRuby on Windows, Mac OS X, and Linux, and IDEs such as NetBeans and Eclipse
  • Package and deploy Rails apps on Java Servlet containers and Java EE application servers, including JBoss, Tomcat, and GlassFish
  • Integrate Ruby and Rails applications with popular Java EE technologies such as JMS, JMX, JPA, Spring, and Hibernate
  • Develop desktop and client applications with cross-platform Java UI technologies and toolkits such as Swing, SWT, and Java 2D
  • Maximize the flexibility of your testing and build environment, using both existing Java-based tools such as Ant and Maven and newer Ruby-based tools such as Rake, Raven, and Buildr

The JRuby interpreter combines Ruby's simplicity and ease of use with Java's extensive libraries and technologies, a potent blend that opens new possibilities for Ruby, Rails, and Java. This Cookbook helps you take full advantage of JRuby's potential.

"The JRuby Cookbook is an excellent book for any polyglot who is trying to bridge the gap between Java and Ruby. It provides solutions to specific problems developers face in both their development and testing environments, along with the applications they're building."— Bob McWhirter, Research & Prototyping, Red Hat Middleware

Read More Show Less

Product Details

  • ISBN-13: 9780596519803
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 11/27/2008
  • Edition number: 1
  • Pages: 224
  • Product dimensions: 7.00 (w) x 9.10 (h) x 0.40 (d)

Meet the Author

Justin Edelson is the Vice President of Platform Engineering for MTV Networks. He was the co-author (with Brett McLaughlin) of Java & XML, 3rd Edition, published in December 2006.

Henry Liu is an experienced software developer and game designer. He is currently a Senior Software Developer at MTV Networks. He maintains an Open Source Ruby project for collaborative filtering named slopeone-gem and is an active member of the New York City Ruby Users Group.

Read More Show Less

Table of Contents

Conventions Used in This Book;
Using Code Examples;
Safari® Books Online;
Comments and Questions;
Chapter 1: Getting Started;
1.1 Introduction;
1.2 Installing JRuby;
1.3 Managing Packages with RubyGems;
1.4 Using Both Ruby and JRuby;
1.5 Sharing RubyGems;
1.6 Referencing Java Classes from Ruby;
1.7 Converting a Ruby Array into a Java Array;
1.8 Adding JAR Files to the Classpath;
1.9 Extending a Java Class in Ruby;
1.10 Implementing a Java Interface in Ruby;
1.11 Opening Java Classes with JRuby;
1.12 Setting Up Eclipse for JRuby Development;
1.13 Setting Up NetBeans for JRuby Development;
1.14 Platform Detection in a JRuby Application;
Chapter 2: JRuby on Rails;
2.1 Introduction;
2.2 Installing and Setting Up Rails;
2.3 Packaging Rails As a Java EE Web Application;
2.4 Using an External Gem Repository with a Web Application;
2.5 Configuring the JRuby-Rack Servlet;
2.6 Packaging Rails with a JNDI DataSource;
2.7 Deploying Rails on Tomcat;
2.8 Deploying Rails on JBoss;
2.9 Deploying Rails on Jetty;
2.10 Deploying Rails with jetty_rails;
2.11 Deploying Rails with Mongrel;
2.12 Deploying Rails on the GlassFish v2 Server;
2.13 Using the GlassFish v3 Gem;
2.14 Using ActiveRecord Outside of Rails;
2.15 Accessing Common Java Servlet Information;
2.16 Configuring Session Storage;
2.17 Controlling the Classes, Directories, and Other Files Packaged into a Rails WAR File;
2.18 Changing the Name of the WAR File and the Staging Area;
2.19 Deploying a Rails Application to the Root Context;
2.20 Creating a Rails Application with Aptana Studio;
2.21 Accessing Static Files in Your Rails Java EE Application;
Chapter 3: Java Integration;
3.1 Introduction;
3.2 Executing Ruby from Java;
3.3 Invoking JRuby Through the Bean Scripting Framework;
3.4 Invoking JRuby Through Java Scripting Support;
3.5 Logging from Ruby with Jakarta Commons Logging;
3.6 Using the Java Concurrency Utilities;
3.7 Creating JavaBean Style Accessor Methods;
3.8 Writing Consistent Code;
3.9 Transforming XML with TrAX;
3.10 Creating a Pool of JRuby Runtimes;
3.11 Performing Remote Management with JMX;
3.12 Accessing Native Libraries with JRuby;
Chapter 4: Enterprise Java;
4.1 Introduction;
4.2 Creating a JNDI Context;
4.3 Sending JMS Messages;
4.4 Receiving JMS Messages;
4.5 Implementing an Enterprise JavaBean with JRuby;
4.6 Defining Spring Beans in JRuby;
4.7 Creating Refreshable JRuby Spring Beans;
4.8 Defining JRuby Spring Beans Inline;
4.9 Applying Spring-Aware Interfaces to JRuby Objects;
4.10 Creating Spring MVC Controllers with JRuby;
4.11 Using Hibernate with JRuby;
4.12 Using the Java Persistence API with JRuby;
4.13 Making SOAP Calls;
4.14 Simplifying LDAP Access;
Chapter 5: User Interface and Graphics;
5.1 Introduction;
5.2 Creating Swing Applications;
5.3 Swing Event Handling;
5.4 Long-Running Tasks in Swing Applications;
5.5 Packaging Standalone Applications;
5.6 Packaging JRuby Web Start Applications;
5.7 Creating JRuby Applets;
5.8 Manipulating Images;
5.9 Creating SWT Applications;
5.10 Accessing the Native Desktop;
5.11 Accessing the System Tray;
5.12 Swing Development with JRuby Domain-Specific Languages;
5.13 Using the Monkeybars Framework for Swing Development;
5.14 Creating Qt Applications with JRuby;
Chapter 6: Build Tools;
6.1 Introduction;
6.2 Adding Ruby Scripting to Ant Builds;
6.3 Using Ruby in Ant Conditions;
6.4 Writing an Ant Task in Ruby;
6.5 Adding Ruby Scripting to Maven Builds;
6.6 Writing a Maven Plugin with JRuby;
6.7 Building Java Projects with Raven;
6.8 Referencing Libraries with Raven;
6.9 Hosting a Private Raven Repository;
6.10 Running JUnit Tests with Raven;
6.11 Building Java Projects with Buildr;
6.12 Referencing Libraries with Buildr;
6.13 Building with Rake Inside Hudson;
6.14 Adding Ruby Script to a Hudson Job;
Chapter 7: Testing;
7.1 Introduction;
7.2 Unit Testing Java Code with Test/Unit;
7.3 Unit Testing Java Code with dust;
7.4 Unit Testing Java Code with Expectations;
7.5 Testing Java Code with RSpec;
7.6 Creating Mock Objects with Mocha;
7.7 Modifying the JtestR Classpath;
7.8 Grouping Tests for JtestR;
7.9 Using the JtestR Command-Line Options;
7.10 Running JtestR with Ant;
7.11 Running JtestR with Maven;
7.12 Improving JtestR Performance;
Chapter 8: The JRuby Community;
8.1 Introduction;
8.2 Building JRuby from Source;
8.3 Submitting an Issue Report for JRuby;
8.4 Using the JRuby Mailing Lists;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)