Skip to content

Instantly share code, notes, and snippets.

@lorenzoplanas
Created September 12, 2011 05:05
Show Gist options
  • Select an option

  • Save lorenzoplanas/1210626 to your computer and use it in GitHub Desktop.

Select an option

Save lorenzoplanas/1210626 to your computer and use it in GitHub Desktop.
jruby - develop & test using jruby interpreter. Compile the code to Java bytecodes and run it straight away
# encoding: utf-8
require "Foo"
class Bar
def self.say_hello
Foo.say_hello
end
end
p Bar.say_hello
jruby Bar.rb
-> "Hello world!"
jrubyc Foo.rb
-> Creates Foo.class
jrubyc Bar.rb
-> Creates Bar.class
java -cp .:$GEM_HOME/gems/jruby-jars-1.6.4/lib/jruby-core-1.6.4.jar -Djruby.compat.version=RUBY1_9 Bar
-> "Hello world!"
jruby Bar.rb
-> "Hello world!"
jrubyc Foo.rb
-> Creates Foo.class
jrubyc Bar.rb
-> Creates Bar.class
java -cp .:$GEM_HOME/gems/jruby-jars-1.6.4/lib/jruby-core-1.6.4.jar -Djruby.compat.version=RUBY1_9 Bar
-> "Hello world!"
# encoding: utf-8
class Foo
def self.say_hello
"Hello world!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment