JRuby: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Add a link.)
mNo edit summary
 
Line 3: Line 3:
# => "jruby"</lang>{{infobox end}}
# => "jruby"</lang>{{infobox end}}


JRuby is an implementation of Ruby that runs inside the [[runs on vm::Java Virtual Machine]] and can call Java libraries from Ruby code. JRuby 1.6.x implements both Ruby 1.8.7 and Ruby 1.9.2 in one install.
JRuby is an implementation of Ruby that runs inside the [[runs on vm::Java Virtual Machine]] and can call Java libraries from Ruby code. JRuby 9.2.x approximates to Ruby 2.5.x.


JRuby has preemptive concurrency like Java; each Ruby Thread is a Java Thread. JRuby can run multiple threads in parallel on multiple CPUs, if the JVM can do so. [[MRI]] has a Global VM Lock and can run these threads on only one CPU. In contrast, JRuby can never fork processes; MRI can fork with some platforms.
JRuby has preemptive concurrency like Java; each Ruby Thread is a Java Thread. JRuby can run multiple threads in parallel on multiple CPUs, if the JVM can do so. [[MRI]] has a Global VM Lock and can run these threads on only one CPU. In contrast, JRuby can never fork processes; MRI can fork with some platforms.

Latest revision as of 15:07, 30 May 2020

JRuby is an implementation of Ruby. Other implementations of Ruby.
<lang ruby>p RUBY_ENGINE
  1. => "jruby"</lang>

JRuby is an implementation of Ruby that runs inside the Java Virtual Machine and can call Java libraries from Ruby code. JRuby 9.2.x approximates to Ruby 2.5.x.

JRuby has preemptive concurrency like Java; each Ruby Thread is a Java Thread. JRuby can run multiple threads in parallel on multiple CPUs, if the JVM can do so. MRI has a Global VM Lock and can run these threads on only one CPU. In contrast, JRuby can never fork processes; MRI can fork with some platforms.

JRuby implements the interpreter and most of the core library in Java. The standard library is a mix of Java and Ruby.