Skip to content

JRuby simple example

JRuby is a Java implementation of the Ruby interpreter, with an tightly integrated with Java. In this examples you will call swing components.

On Ubuntu you can get it installing the package jruby (a meta package for jruby1.0 or jruby0.9 packages).

To test it save this code as test.rb and invocate it with the jruby interpreter:

require 'java'

frame =
frame.getContentPane().add('Hello, JRuby World!'))

$ jruby1.0 test.rb

Hello JRuby World

ps: We did not define a close method, so to close this windows you’ll need to kill its process or press Ctrl+C in your terminal.

Published inenglish

One Comment

  1. Gems form the internet…

    […]very few websites that happen to be detailed below, from our point of view are undoubtedly well worth checking out[…]……

Leave a Reply

Your email address will not be published. Required fields are marked *