added support for jruby

This allows phantomjs.rb to work with jRuby.