University of Iowa OSUM
Sign Up

Installing JRuby on Windows

Would you like the simplicity of a scripting language mixed with the power of a language with the ability to create a full GUI? Then JRuby is for you. JRuby is probably one of the most fun implementations of Ruby ever made. Not only does it bring the power, elegance, and simplicity of Ruby, but it features the abilities of Java as well!

Installing

  • Download a copy of the latest JRuby from the JRuby download page.
  • Unzip the file with your achive program. If you don't have one that works, download 7-Zip.
  • Copy the JRuby folder called jruby-1.1.5 directly to "C:/"
  • Install Java if you don't already have it. You'll want want of the latest versions which can be found at Java.com.
  • Set environment variables on your system. Right click "My Computer" go to "Advanced" then "Environmental Variables". Create these:
    • JRUBY_HOME = C:/jruby-1.1.5
    • JAVA_HOME = C:/path/to/java (like C:/Program Files/Java/jre1.6.0_07)
  • Next you'll have to edit the PATH variable. Add ;C:\jruby-1.1.5\bin; to the end of that variable.
  • Setup Complete!

Next we'll be creating our first program. Starting is as simple as creating an empty file called 'program.rb'. Open the file with a text editor, such as Notepad or Wordpad, and insert the text below.

include Java
frame = javax.swing.JFrame.new()
frame.getContentPane().add(javax.swing.JLabel.new('Hello, World!'))
frame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
frame.pack()
frame.set_visible(true)

Now save the file and exit the text editor. Open the command prompt (Start->Run->'cmd'). Change your directory to wherever your file is. If you saved on your Desktop it's usually just 'cd Desktop'. Now type "jruby program.rb", and viola! Enjoy!

Home
About
Communities
Schedule
News

Resources Downloads
Guides
Links

Join OSUM

Link To Us