Skip to content

Instantly share code, notes, and snippets.

@headius
Created February 24, 2010 23:49
Show Gist options
  • Save headius/314044 to your computer and use it in GitHub Desktop.
Save headius/314044 to your computer and use it in GitHub Desktop.
~/projects/jruby ➔ cat remote_rhino.rb
require 'java'
$CLASSPATH << 'http://mirrors.ibiblio.org/pub/mirrors/maven2/rhino/js/1.7R2/js-1.7R2.jar'
ctx = org.mozilla.javascript.Context.enter
scope = ctx.init_standard_objects nil
result = ctx.evaluate_string scope, 'function f(x){return x+1} f(7)', 'x', 1, nil
puts result
~/projects/jruby ➔ jruby remote_rhino.rb
8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment