I’m still getting everything back together after the iMac upgrade fiasco. JRuby, my favorite Ruby implementation, is still missing. I think I’ll fix that now.
- Grab the binary of 1.03 from the JRuby site.
cd /usr/localsudo tar xfvz ~/jruby-bin-1.0.3.tar.gzsudo ln -s /usr/local/jruby-1.0.3/ /usr/local/jruby- Add JRuby details to my (somewhat busy) bash profile
export JRUBY_HOME="/usr/local/jruby"</strong># OS X is normally conservative about paths, while I am generous about them.export LOCALBINS=/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/X11R6/binexport APPBINS=$JRUBY_HOME/binexport PATH=$APPBINS:$LOCALBINS:$PATH
if [ -r ~/.bashrc ]; then . ~/.bashrcfiSource the file and test my path …
$ . ~/.bash_profile$ which jruby/usr/local/jruby/bin/jruby$ which gem/usr/local/jruby/bin/gemTest with the sample code from Getting Started on the JRuby wiki.
require "java"
include_class "java.util.TreeSet"
puts "Hello from JRuby"set = TreeSet.new()set.add( "foo" )set.add( "Bar" )set.add( "baz" )set.each { |v| puts "value: #{v}" }Run it.
$ jruby call_java.rbWait a very long time (why does Java startup have to be so slow on our Mac and how the heck can I make it faster? It’s one thing that’s significantly worse on our Mac compared to my PC). Eventually see:
$ jruby call_java.rbHello from JRubyvalue: Barvalue: bazvalue: fooExcellent, it worked. It’s 2:46 now. I better post this and go to bed.