Fact-checked by Grok 2 weeks ago

JRuby

JRuby is an open-source implementation of the Ruby programming language that executes on the Java Virtual Machine (JVM), enabling Ruby developers to leverage the performance, threading model, and extensive ecosystem of Java while maintaining compatibility with standard Ruby code. Written primarily in Java, it provides a high-performance, stable, and fully threaded alternative to the canonical Matz's Ruby Interpreter (MRI), with seamless interoperability for calling Java libraries from Ruby or embedding Ruby scripts in Java applications. Key features include true multithreading without Ruby's Global Interpreter Lock (GIL), allowing for genuine parallelism in concurrent programming, and support for JVM-specific optimizations like invokedynamic for faster execution. Development of JRuby began in the early 2000s as a community-driven project, with leadership from Charles Oliver Nutter and Thomas Enebo, building on contributions including code shared by Ruby's creator, . Licensed under the (EPL), (GPL), and Lesser GPL (LGPL), it has progressed through multiple major versions, focusing on aligning with evolving standards. Notable milestones include the 9.x series achieving Ruby 3.1 compatibility by 2022, followed by the release of JRuby 10.0.0.0 in April 2025, which targets Ruby 3.4 and requires Java 21 as a minimum, incorporating advanced JVM features like Project Loom for enhanced concurrency. This evolution has made JRuby particularly suitable for enterprise environments, web applications such as those using , and hybrid Java-Ruby systems.

History

Origins and Early Development

JRuby originated as an open-source project in 2001, initiated by Jan Arne Petersen, who built upon earlier efforts by Stefan Matthias Aust to port the interpreter from to . The project aimed to create a Ruby implementation capable of running on the (JVM), allowing developers to execute Ruby code within Java environments while accessing the JVM's robust ecosystem of libraries and tools. The primary early goals focused on delivering high compatibility with the Ruby language, particularly targeting Ruby 1.8 features, while harnessing the JVM's advantages such as improved performance through , true multi-threading without the limitations of the standard Ruby interpreter (MRI), and seamless integration with existing Java applications. Initial development emphasized pure Java implementations to avoid reliance on native C extensions, which were a staple in the original Ruby but posed portability issues on the JVM; instead, core Ruby functionalities were reimplemented in Java or Ruby itself for better cross-platform reliability. One of the key challenges in the early phases was achieving full 1.8 compatibility without direct access to C-based extensions, requiring developers to craft Java equivalents for Ruby's dynamic behaviors, such as and object model intricacies, often starting with basic interpreters and parsers. In late 2002, Thomas Enebo joined the and assumed leadership by late 2003, accelerating progress on these fronts. A pivotal contribution came in fall 2004 when Charles Nutter discovered the at RubyConf and began actively developing it, leading to significant enhancements in the parser and interpreter that improved overall Ruby fidelity. These efforts laid the groundwork for JRuby's evolution into a viable alternative Ruby runtime, prioritizing conceptual alignment with Ruby standards over exhaustive feature replication at the outset.

Adoption and Key Milestones

In the mid-2000s, JRuby saw significant adoption alongside the rise of , particularly for deploying Rails applications on established Java infrastructure such as servers, which addressed scalability challenges inherent in the original interpreter by leveraging the JVM's mature threading and garbage collection capabilities. This integration allowed Ruby developers to benefit from 's enterprise ecosystem without sacrificing Rails' productivity, fostering wider use in production environments where high concurrency was required. Key milestones marked JRuby's maturation, including the release of version 1.0 in June 2007, which achieved full compatibility with 1.8.x and positioned JRuby as a viable alternative for standard applications. Another pivotal advancement came in 2011 with the introduction of invokedynamic support alongside 7, enabling more efficient dynamic method invocation and significantly boosting JRuby's runtime performance for code on the JVM. Organizationally, JRuby's development shifted in May 2012 when core contributors Charles Nutter and Thomas Enebo joined from Engine Yard, providing dedicated resources and integrating JRuby more deeply into 's open-source portfolio. This sponsorship lasted until July 2024, when discontinued funding, prompting Nutter's departure; however, development has persisted through community efforts and new sponsorships, culminating in the release of JRuby 10 in April 2025 with Ruby 3.4 compatibility. Notable collaborations expanded JRuby's reach, such as the Ruboto project in the , which enabled application development for by integrating JRuby with the and allowing seamless access to APIs from code. Additionally, ongoing alignment with RubySpec tests has ensured progressively better compatibility with Matz's Ruby Interpreter (MRI), with versions like JRuby 9.3 maintaining sync with 2.6.x semantics and passing the majority of the shared .

Release History

JRuby's development began in the early , with the project originating as an effort to implement on the platform. The first stable release, JRuby 1.0, arrived in June 2007, marking full with Ruby 1.8 and enabling use for simple applications, though it relied on an interpreted without advanced optimizations. Subsequent updates in the 1.x series built on this foundation, culminating in JRuby 1.7.0 in October 2012, which introduced comprehensive Ruby 1.9 as the default mode, including support for new language features like fibers and improved encoding handling. To align with Ruby's versioning for better parity, the project shifted from the 1.x numbering to the 9k series starting in 2015. JRuby 9.0.0.0, released in July 2015, targeted 2.2 compatibility, incorporating a new compiler-based runtime, enhanced (FFI) for native code integration, and initial support for lightweight concurrency. The 9k series continued through multiple point releases, with JRuby 9.4.0.0 in November 2022 achieving Ruby 3.1 compatibility, further refining FFI performance and implementation to match MRI Ruby's behavior. In a major evolution, JRuby adopted three-digit versioning beginning with 10.0.0.0, released on , 2025, to reflect support for 3.4. This release mandated 21 as the minimum requirement, enabled full invokedynamic optimizations by default for superior performance, and significantly reduced startup times—for example, a basic "" script now launches in approximately 0.8 seconds (compared to about 1 second in JRuby 9.4) with the --dev flag on 21. Subsequent updates, such as 10.0.1.0 in July 2025 and 10.0.2.0 in August 2025, addressed bug fixes and library updates while maintaining Ruby 3.4 parity. The following table summarizes key releases and their Ruby compatibility milestones:
VersionRelease DateRuby CompatibilityMajor Highlights
1.0June 20071.8Full Ruby 1.8 support; interpreted for production basics.
1.7.0October 20121.9Default 1.9 mode; fibers and encoding improvements.
9.0.0.0July 20152.2 ; enhanced FFI; start of 9k series for 2.x .
9.4.0.0November 20223.1Refined fibers; 9k series maturation.
10.0.0.0April 20253.4Java 21 minimum; default full optimizations; faster startup; three-digit numbering for 3.x .

Design and Implementation

Core Architecture

JRuby is implemented entirely in , with its parser, lexer, and runtime environment developed as pure Java code to ensure seamless execution on the (JVM). The parser is based on a / port from the original Ruby implementation, adapted to Java using the Jay parser generator, while the lexer is hand-written to process Ruby source code efficiently. This Java-centric design allows JRuby to leverage the JVM's robust ecosystem, including its libraries and tools, without relying on native C extensions typical of other Ruby implementations. The core runtime revolves around the central Ruby class, which serves as the primary for execution and manages state, while each maintains its own ThreadContext object to local execution details such as the call stack, backtraces, and . JRuby's threading model maps Ruby threads one-to-one with underlying Java threads, enabling fully multi-threaded operation without a (GIL), in contrast to Matz's Ruby Interpreter (MRI), which serializes execution. This architecture supports true parallelism across multi-core systems, with critical sections protected by a mutex and periodic polling to interrupts like kill or raise signals. The execution pipeline begins with Ruby source code being parsed into an Abstract Syntax Tree (AST), which includes line positions and, in extended forks, byte offsets and comments for enhanced debugging. The AST is then transformed into Intermediate Representation (IR) scopes, such as IRMethod or IRClosure, initially executed in interpreted mode for rapid startup. For performance in long-running applications, JRuby employs just-in-time (JIT) compilation, converting IR to JVM bytecode after a threshold of invocations—typically around 50 calls—allowing the JVM's own optimizers to further compile it to native code. Memory management in JRuby relies on the JVM's collector, which automatically handles allocation and deallocation of objects, providing predictable pause times and scalability for large heaps. Ruby objects are represented as Java classes, with wrappers facilitating interaction between Ruby and Java entities, while runtime-generated classes are loaded via dynamic classloaders to enable collection of unused code paths. This approach avoids issues found in C-based Ruby implementations, though it introduces considerations for and scopes stored externally to support dynamic behavior.

Ruby Compatibility and Standards

The JRuby 10.x series, starting with version 10.0.0.0 released in April 2025, targets compatibility with 3.4 syntax and semantics as of November 2025, incorporating features from 3.2, 3.3, and 3.4. This update marks a significant advancement in aligning JRuby with the latest evolutions of the language, enabling developers to utilize contemporary Ruby constructs seamlessly on the JVM. Earlier versions of JRuby, such as 9.4.x, targeted 3.1 compatibility, demonstrating a pattern of periodic jumps to match major releases. For , JRuby supports older Ruby versions from 1.8 to 3.x through command-line flags and modes, such as the --1.8 option to emulate Ruby 1.8.7 behavior in versions post-JRuby 1.7.0, where Ruby 1.9 mode became the default. This flexibility allows legacy Ruby codebases to run with minimal modifications, though full fidelity depends on the targeted Ruby version of the JRuby release in use. Compatibility modes ensure that and core behaviors from prior Ruby iterations remain viable, bridging gaps for applications not yet migrated to the latest standards. JRuby adheres to Ruby language standards by passing approximately 90% of the RubySpec testsuite as of 2025, with over 95% compliance in core language and library areas—a comprehensive benchmark for Ruby implementations that verifies syntax, semantics, and behavior across implementations. This high level of compliance enables native handling of Ruby's dynamic features, such as techniques like method_missing and define_method, as well as block-based iterators and closures, without deviations that would break standard Ruby idioms. Ongoing development prioritizes closing any remaining spec gaps to maintain with the Ruby ecosystem. In handling C extensions, a common requirement for many Ruby gems, JRuby eschews direct support for MRI-style native extensions in favor of the Foreign Function Interface (FFI) library, which allows calling C libraries dynamically from Ruby code. This approach provides cross-implementation portability, as FFI works across Ruby runtimes including JRuby, MRI, and others. For gems dependent on C libraries, developers can leverage Java-based equivalents or pure-Ruby alternatives, such as ffi-ncurses for ncurses bindings, ensuring functionality without recompiling native code for the JVM. Key differences from Matz's Ruby Interpreter (MRI) include the absence of a (GIL), allowing true parallelism in multithreaded applications via the JVM's native threading model, while emulating Ruby's expected semantics for compatibility. This design avoids MRI's single-threaded execution bottleneck but requires careful handling of shared state to prevent race conditions. Occasional deviations from RubySpec, such as variations in priorities or resource usage, are documented and systematically fixed in subsequent releases to enhance spec conformance.

JVM-Specific Optimizations

JRuby leverages the Java Virtual Machine's (JVM) invokedynamic bytecode instruction, introduced in 7, to optimize dynamic dispatch inherent to Ruby's late binding semantics. This feature allows JRuby to generate more efficient call sites at , reducing the overhead associated with Ruby's dynamic nature by enabling the JVM to inline and specialize invocations based on observed . In JRuby 10, invokedynamic optimization is enabled by default without requiring additional flags, marking a shift from the middle-tier optimization in prior versions like 9.4, and it has been significantly refined since 8 for better compatibility and gains. For just-in-time (JIT) compilation, JRuby relies on the JVM's built-in compilers to optimize hot code paths, with invokedynamic facilitating more aggressive inlining and specialization of Ruby methods. This integration ensures that frequently executed Ruby code is compiled to native , improving throughput for long-running applications. In JRuby 10, which requires Java 21 as a minimum, full optimization mode is the default, allowing the JVM's —such as the Client or Server compiler—to apply advanced techniques like and tailored to Ruby workloads. While experimental Truffle framework support was introduced in earlier versions like JRuby 9.1 for potential Graal enhancements, current implementations prioritize the standard JVM for stability and broad compatibility. Garbage collection in JRuby is tuned through direct integration with JVM algorithms, enabling developers to select collectors suited to low-latency Ruby applications. For instance, the G1 collector can be activated via the -J-XX:+UseG1GC flag to balance throughput and pause times, while ZGC—available since Java 15—is invoked with -J-XX:+UseZGC for sub-millisecond pauses on large , making it ideal for or high-concurrency Ruby services on JRuby. These options allow fine-grained control over heap sizing (e.g., -J-Xms and -J-Xmx set to matching values for stability) and young generation allocation, minimizing disruptions in Ruby's object-heavy workloads without custom JRuby modifications. Startup improvements in JRuby 10 incorporate JVM features like the Application Class-Data Sharing (AppCDS) mechanism, enabled by default on Java 21 and later, which archives core class metadata to accelerate class loading and reduce cold start times. This optimization, combined with classpath streamlining, significantly reduces initial boot durations—for example, halving the startup time of typical JRuby commands and reducing "hello world" execution from approximately 0.99 seconds to 0.81 seconds (an ~18% improvement) in simple scripts. Additionally, support for ahead-of-time (AOT) compilation hints via Project Leyden previews in Java 24 and later further enhances this by pre-compiling optimization profiles, achieving up to 50% reductions in startup for configured environments through tools like AOTCache. JRuby 10 also integrates Project Loom for lightweight virtual threads, enabling support for thousands of Ruby Fibers with enhanced concurrency, and Project Panama for improved native function calling via foreign links.

Interoperability

Accessing Java from JRuby

One of the key features of JRuby is its seamless interoperability with , allowing Ruby developers to directly invoke Java classes, methods, and libraries from Ruby code running on the (JVM). This integration enables the reuse of extensive Java ecosystems, such as standard libraries and third-party frameworks, without needing to write bridging code. To begin accessing Java, Ruby scripts in JRuby typically require the 'java' library, which loads Java classes from the . Import mechanisms in JRuby simplify the loading of packages and classes into the Ruby namespace. The require 'java' statement activates access to bundled Java libraries available in the JVM's . Once loaded, developers can use java_import to bring specific Java classes into scope as Ruby constants, for example, java_import java.lang.[System](/page/System) allows direct reference to System. Alternatively, include_package or include_class imports entire packages or individual classes as Ruby modules, such as include_package 'java.lang' to treat java.lang as a Ruby module for easier navigation. These mechanisms ensure that Java elements behave like native Ruby constructs, promoting fluid . These features remain compatible with JRuby 10.0 (released April 2025). Java objects in JRuby are treated transparently as Ruby objects, with automatic type conversions to maintain compatibility. For instance, Ruby strings convert to java.lang.String, integers to java.lang.Long or java.lang.Integer based on context, and Ruby arrays can be transformed into Java arrays via methods like [1, 2, 3].to_java(:int). Conversely, Java primitives like int map to Ruby's Fixnum, doubles to Float, and Java collections like List integrate with Ruby's enumerable interfaces for iteration and manipulation. This bidirectional conversion minimizes friction, allowing developers to pass Ruby data structures directly to Java methods without explicit casting. Method invocation from Ruby to Java uses dynamic dispatch with Ruby syntax, where Java methods are called as if they were Ruby methods on the object. Overloaded Java methods are resolved by matching argument types and counts, enabling calls like system.out.println("Hello from JRuby") after importing java.lang.[System](/page/System). For ambiguous overloads or performance-critical scenarios, JRuby provides java_send for explicit method specification, such as list.java_send(:add, [Java::int, java.lang.Object], 0, "item"), or java_method to cache method handles. This approach supports both static and dynamic typing patterns inherent to Ruby. Exception handling bridges 's checked exceptions with 's dynamic error model, where Java exceptions are wrapped as Ruby StandardError subclasses for blocks. Developers can catch specific Java exceptions directly, as in begin ... [rescue](/page/Rescue) java.lang.NumberFormatException => e; puts e.message; end, or raise Java exceptions from Ruby using raise java.lang.IllegalArgumentException.new("Error message"). This integration ensures robust error propagation across language boundaries. Practical use cases demonstrate JRuby's power in leveraging Java libraries. For integrating Apache Commons, such as using Commons Math for numerical computations, a Ruby script might import org.apache.commons.math3.fraction.BigFraction via java_import and perform operations like fraction = BigFraction.new(1, 3); result = fraction.multiply(BigFraction.new(2)), assuming the JAR is on the classpath. Similarly, for integration, Ruby code can instantiate a Spring application context with context = org.springframework.context.support.ClassPathXmlApplicationContext.new("applicationContext.xml".to_java(:string)) and retrieve beans via service = context.getBean("myService"), enabling Ruby applications to utilize Spring's and configuration. These examples highlight how JRuby facilitates hybrid applications that combine Ruby's expressiveness with Java's mature tooling.

Embedding JRuby in Java

JRuby enables Java applications to embed and execute Ruby code dynamically, leveraging the Java Scripting (JSR-223) for standard integration or the JRuby-specific Embed for more advanced control. The JSR-223 approach uses the ScriptEngineManager to obtain a JRuby ScriptEngine instance by name ("jruby"), allowing seamless execution of Ruby scripts within Java code. For enhanced functionality, such as fine-grained configuration of the Ruby runtime, developers use the ScriptingContainer from the JRuby Embed (RedBridge), which manages the Ruby interpreter, variable scopes, and execution context. These are compatible with JRuby 10.0, which requires Java 21 and incorporates Project Loom for improved concurrency in multi-threaded embedding scenarios. Evaluation and execution of Ruby code occur primarily through the eval method in both APIs. In JSR-223, engine.eval(rubyCode) runs Ruby snippets directly, supporting features like requiring libraries or creating Ruby objects that can be cast to Java types. For instance, the following Java code evaluates a Ruby expression and retrieves a result:
java
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jruby");
Object result = engine.eval("1 + 2");  // Returns 3 as a Java Long
With ScriptingContainer, runScriptlet or evalScriptlet provides similar execution but with additional options for parsing and compilation. Variable sharing between Java and Ruby scopes is facilitated by Bindings in JSR-223 or the container's variable map in the Embed API, enabling bidirectional data passing—such as passing a Java Map to Ruby as a or retrieving Ruby arrays as Java lists. Runtime management in embedded JRuby supports creating multiple isolated runtimes to avoid interference in multi-threaded or modular applications. Each ScriptingContainer instance can be configured with a specific LocalContextScope (e.g., for shared runtime or SINGLETHREAD for isolation per container), and Ruby globals or constants can be accessed or set from Java via the runtime's binding mechanisms. For example, a can be set in Java and read in Ruby:
java
import org.jruby.embed.ScriptingContainer;
ScriptingContainer container = new ScriptingContainer();
container.put("$global_var", "Hello from Java");
container.runScriptlet("puts $global_var");  // Outputs: Hello from Java
Object constant = container.runScriptlet("Math::PI");  // Accesses Ruby constant
This isolation ensures when using THREADSAFE scope, while allowing customization of Ruby compatibility version or load paths. With JRuby 10's Project Loom integration, virtual threads enhance performance for concurrent Ruby script execution. Common use cases for embedding JRuby include dynamic scripting in Java-based games or development tools, where Ruby's concise syntax enhances or configuration logic. Bidirectional data passing supports scenarios like processing Java data structures in Ruby for complex computations, then returning results—such as converting Ruby hashes to Java maps for further application use—without deep integration overhead.

Integration with Java Frameworks

JRuby facilitates the creation of hybrid applications by allowing Ruby code to leverage established frameworks, enabling developers to combine the expressiveness of with the robustness of Java ecosystems. This integration is achieved through JRuby's seamless with the (JVM), permitting Ruby applications to interact with Java libraries and services without significant overhead. In , JRuby supports deploying applications to Java servlet containers such as or by packaging them as Web Application Archive () files using the gem. Warbler bundles the Rails application, including dependencies, into a standard WAR format compatible with web servers, allowing Rails apps to run alongside Java-based web services in enterprise environments. For enterprise applications, JRuby integrates with frameworks like through its scripting support, where Ruby scripts can be embedded as Spring beans to handle dynamic logic or data processing via JSR-223. Similarly, Hibernate can be accessed from JRuby code via direct API calls or by using Ruby ORMs like that connect to Hibernate-managed connection pools, enabling unified database access in mixed-language systems. Additionally, JRuby applications can utilize Java EE features, such as services for transaction management and security, by running within compliant containers like or . In build and testing workflows, JRuby projects integrate with using the jruby-maven-plugins, which manage Ruby gems alongside Java dependencies and support tasks like compiling Ruby code or running RSpec tests within Maven builds. For Gradle-based projects, the jruby-gradle-plugin enables mixed-language dependency resolution, gem installation, and execution of Ruby scripts as build tasks. Testing frameworks like can invoke Ruby modules by embedding a JRuby in Java test classes, allowing comprehensive validation of hybrid components. Beyond traditional servers, JRuby extends to mobile development through Ruboto, a platform that allows writing native applications in by accessing Android APIs via JRuby's Java interop. For modular deployments, JRuby is compatible with environments, where Ruby components can be bundled as OSGi modules and dynamically loaded alongside Java services in frameworks like Apache Karaf.

Performance

Optimization Techniques

JRuby performance can be tuned through careful configuration of JVM parameters, which directly influence and behavior. For sizing, the -Xmx flag sets the maximum size, such as -J-Xmx2g to allocate up to 2 GB, preventing out-of-memory errors in memory-intensive applications, while -J-Xms establishes the initial size to reduce resizing overhead during startup. Enabling tiered with -J-XX:+TieredCompilation allows the JVM to progressively optimize code from interpreted to fully compiled, improving long-running workload efficiency on the server VM. Additionally, reserving code cache space via -XX:ReservedCodeCacheSize=256m accommodates the generated from JRuby's , avoiding disables in high-throughput scenarios. Ruby-specific tuning options further refine execution dynamics within JRuby. The --dev flag prioritizes quick startup by disabling advanced optimizations like full invokedynamic usage, suitable for environments, whereas production deployments omit this flag to enable complete JIT compilation and invokedynamic by default in recent versions like JRuby 10, which leverages Java's invokedynamic instruction for efficiency on Java 21+. For foreign function interface (FFI) interactions, JRuby defaults to the optimized JNR-FFI , which uses native bindings rather than emulated pure-Ruby fallbacks; explicitly setting jruby.native.enabled=true ensures this high-performance path, avoiding slower emulations for C calls. JIT thresholds can be adjusted with jruby.jit.threshold=25 to compile frequently invoked methods earlier, balancing warmup time against runtime speed. Profiling tools integrated with the JVM ecosystem help identify bottlenecks, particularly in Ruby-Java boundary operations. VisualVM, a standard JVM monitoring tool, connects to JRuby processes via JMX to visualize CPU usage, heap allocations, and thread states, revealing inefficiencies in interop calls. Flight Recorder (JFR), enabled with -XX:StartFlightRecording=duration=60s,filename=recording.jfr, captures low-overhead events for analyzing garbage collection pauses and method hotspots in JRuby applications, with analysis via Java Mission Control. JRuby's built-in profiler, activated by --profile=api, generates call graphs to pinpoint slow Ruby methods before drilling into JVM-level details. For concurrency, JRuby exploits the JVM's native threading model, lacking Ruby MRI's global interpreter lock, to achieve true parallelism. Enabling the thread pool with jruby.thread.pool.enabled=true and tuning jruby.thread.pool.max=100 reuses threads for I/O-bound tasks, reducing creation overhead in web servers like Puma. Fibers, supported since Ruby 1.9 and optimized in JRuby 10 for thousands of concurrent instances using Project Loom's virtual threads, enable lightweight cooperative multitasking via Fiber.new, ideal for asynchronous workflows without full thread overhead; configure fiber.thread.pool.ttl=30 to manage underlying thread lifecycles. Actor models, implemented via gems like celluloid or Java's Akka integration, facilitate message-passing concurrency to isolate state and avoid shared mutable data issues. In deployments, multi-threaded configurations scale better for CPU-bound workloads on multi-core systems, whereas multi-process setups (e.g., via Unicorn) provide fault isolation but incur higher memory costs per process.

Benchmark Results and Comparisons

JRuby 10 demonstrates significant throughput advantages over MRI (CRuby) in multi-threaded workloads, achieving up to 6x higher performance in scenarios like calls due to its native support for true OS threads on the JVM. For instance, in the threaded tarai benchmark, JRuby 10 completes execution in 4.26 seconds compared to 25.06 seconds on CRuby 3.4. These results highlight JRuby's edge in parallel execution. In real-world applications, such as running the server, JRuby provides higher throughput than CRuby under concurrent loads, benefiting from JVM's efficient thread management. Startup times in JRuby 10 have improved substantially with the 2025 release, leveraging 21 features like Application Class-Data Sharing (AppCDS) to reduce times for simple scripts to 0.81 seconds (with -- flag) from 0.99 seconds in JRuby 9.4. Further enhancements in JDK 25's AOTCache reduce baseline startup from 943 ms to 581 ms (38% faster), and with , to 423 ms (55% faster overall), approaching but not yet matching CRuby's ~45 ms baseline. However, usage remains higher due to JVM overhead, typically 1.5-2x that of CRuby for equivalent workloads, though tunable via heap sizing. Compared to MRI, JRuby 10 exhibits competitive or superior performance in single-threaded operations (e.g., Array#concat at 3.037k i/s on JRuby vs. 1.456k i/s on CRuby, and Array#+ at 13.653 i/s vs. 3.420 i/s), while excelling in multi-threaded applications. Versus TruffleRuby, both employ JIT compilation, but JRuby outperforms in Java interoperability scenarios, such as embedding in JVM ecosystems (as of earlier benchmarks in 2022, TruffleRuby led in raw single-threaded compute-intensive tasks by up to 6x in warmed states). Key factors influencing these results include the default use of invokedynamic in JRuby 10, which yields approximately 2x faster method dispatch speeds compared to non-invokedynamic modes by optimizing dynamic calls at runtime. Additionally, 21's garbage collection enhancements, such as improved ZGC with sub-millisecond pauses, minimize interruptions in JRuby applications, reducing in high-throughput environments.

Ecosystem

Supported Ruby Frameworks

JRuby provides full support for major Ruby web frameworks, enabling developers to build and deploy applications leveraging the Java Virtual Machine's performance characteristics. Ruby on Rails is comprehensively supported up to version 7.1, including its core components like ActiveRecord for database interactions, with ongoing efforts to extend compatibility to Rails 8.x. Sinatra, a lightweight DSL for web applications, runs seamlessly on JRuby due to its pure Ruby implementation, allowing for rapid development of APIs and microservices without compatibility issues. For deployment, JRuby-specific gems such as Trinidad facilitate embedding Rails or Rack-based applications in an Apache Tomcat container, simplifying the transition to Java-based hosting environments. In the areas of data handling and testing, JRuby integrates effectively with key Ruby libraries. ActiveRecord, Rails' object-relational mapping framework, operates fully up to version 7.1 and pairs with Java database drivers like JDBC for to or . Testing frameworks including RSpec and Minitest are fully compatible, supporting threaded parallelization on JRuby to leverage multi-core JVM capabilities for faster test suites. The Nokogiri gem, widely used for XML and parsing, employs a Java backend in its JRuby variant, utilizing libraries like Xerces for standards-compliant processing without relying on native C extensions. While JRuby achieves high compatibility with the ecosystem—running the vast majority of pure Ruby gems without modification—limitations arise with gems dependent on native C extensions, which JRuby does not support directly due to its JVM-based architecture. Workarounds include using (FFI) bindings to call native code or opting for pure-Java implementations, ensuring that most popular gems function effectively with minimal adjustments. Deployment of JRuby-powered Ruby applications is straightforward on cloud platforms, particularly for scalable Rails apps. On , JRuby configurations can be specified in the Gemfile to deploy Rails applications using the platform's Ruby buildpack, benefiting from automatic scaling and managed JVM resources. Similarly, supports JRuby Rails deployments via WAR packaging or EB CLI, allowing integration with services like for databases and enabling horizontal scaling across EC2 instances. These options highlight JRuby's suitability for production environments requiring high throughput and reliability.

Tools and Community Resources

JRuby developers benefit from robust IDE integration that facilitates mixed Ruby and Java workflows. The Ruby plugin for Ultimate provides full support for JRuby runtimes, including , refactoring, and capabilities tailored for Java interoperability. Similarly, RubyMine, JetBrains' dedicated Ruby IDE, offers seamless JRuby configuration through its runtime settings, enabling efficient development of applications that leverage both Ruby gems and Java libraries. For lighter environments, extensions such as the Ruby LSP and rdbg debugger support JRuby execution and mixed-language , allowing breakpoints across Ruby and Java codebases. Build tools for JRuby emphasize standalone deployment and hybrid project management. The jruby-complete encapsulates the full JRuby , , and popular gems like IRB (accessed via jirb) and , enabling rake tasks to run directly on the JVM without external dependencies. For polyglot projects, the jruby-maven-plugins suite integrates Ruby tasks into builds, supporting gem management, RSpec testing, and Rake execution alongside Java compilation. The JRuby thrives through open-source collaboration and accessible resources. The official repository serves as the central hub for , hosting , issue tracking, and contributions from a global team. Developers engage via the Matrix #jruby room for real-time discussions, which bridges to other platforms and maintains public logs for transparency. Comprehensive , including references, wikis, and mailing lists for user and developer queries, is available on the JRuby website. Community-driven events, such as presentations at broader Ruby conferences, foster knowledge sharing on JRuby advancements. Extensions like Ruboto extend JRuby to mobile development, providing a framework for building native applications in Ruby using JRuby on the JVM, with integration for modern workflows. Ongoing contributions ensure compatibility with emerging Ruby versions, with JRuby 10 achieving full support for Ruby 3.4 features as of 2025.

References

  1. [1]
    jruby/jruby: JRuby, an implementation of Ruby on the JVM - GitHub
    JRuby is an implementation of the Ruby language using the JVM. It aims to be a complete, correct and fast implementation of Ruby.
  2. [2]
    Home — JRuby.org
    Oct 23, 2025 · JRuby is a high performance, stable, fully threaded Java implementation of the Ruby programming language.DownloadsGetting StartedCommunityJRuby 10.0.0.0 ReleasedDocumentation
  3. [3]
    JRuby 10.0.0.0 Released
    Apr 14, 2025 · Monday, April 14 2025​​ The JRuby community is pleased to announce the release of JRuby 10.0. 0.0.Jruby 10.0. 0.0 Released · Monday, April 14 2025 · Java 21Missing: creators | Show results with:creators
  4. [4]
    JRubyOnRails · jruby/jruby Wiki - GitHub
    Dec 4, 2014 · You can use JRuby with Ruby on Rails. JRuby gives Rails the power and functionality of the Java Platform, providing it with:Missing: creators | Show results with:creators
  5. [5]
    JRuby | Object Computing, Inc.
    Jan Arne Petersen started JRuby project in 2001, building on the work by Aust. Thomas Enebo began work on JRuby in late 2002 and became the project lead in late ...
  6. [6]
    JRuby - The Ruby Compiler Survey
    JRuby began in 2001, with Jan Arne Petersen and Stefan Matthias Aust and an effort to port the Ruby interpreter from C to Java. The first commit included an AST ...
  7. [7]
    Interview: JRuby Development Team | Linux Journal
    Jul 17, 2006 · Charles Nutter: I had begun to hear more about Ruby from friends in the fall of 2004 and was just starting to learn it. I discovered that ...
  8. [8]
    Deploying Rails to Tomcat as a WAR with JRuby
    May 25, 2007 · Install and Configure JRuby. First step download install JRuby. You can get it at: http://dist.codehaus.org/jruby/. After pulling ...Missing: adoption mid- 2000s scalability
  9. [9]
    How is it that JVM applications are far more scalable than Ruby on ...
    Dec 7, 2016 · You can run Ruby on Rails in JVM. It's called JRuby on Rails. Ruby running on JVM has zero performance difference with Java running in JVM. The ...
  10. [10]
    JRuby 1.0 Released! - Headius
    Jun 10, 2007 · JRuby 1.0 was focused almost entirely on one goal: Ruby 1.8.x compatibility. To that end, we are now the only alternative Ruby ...
  11. [11]
    JRuby and Java 7: What to Expect - Charles Oliver Nutter
    Aug 2, 2011 · JRuby's master branch already takes heavy advantage of invokedynamic, by routing most Ruby calls through invokedynamic operations. For simple ...
  12. [12]
    Red Hat hires lead JRuby developers alongside Engine Yard ...
    May 22, 2012 · Red Hat hires lead JRuby developers alongside Engine Yard partnership. Charles Nutter and Tom Enebo will continue their work on JRuby at Red Hat.
  13. [13]
    JRuby 10 released with jump to Ruby 3.4, Java 21, despite loss of ...
    Apr 15, 2025 · JRuby development has been impacted by Red Hat ceasing its support in July 2024, at which point Nutter left the company, stating that “by the ...
  14. [14]
    JRuby: Upcoming Projects - Charles Oliver Nutter
    Sep 4, 2024 · As I posted on the JRuby blog in July, Red Hat's sponsorship of JRuby has come to an end after twelve exciting years. ... end of 2025.
  15. [15]
    Building Ruboto: Precompiling Ruby for Android
    I've been looking into better ways to precompile Ruby code to classes for deploy on Android devices. Normally, JRuby users can just jar up their ...
  16. [16]
    Ruboto
    The Ruboto project aims to add some additional sample code to make the integration between Java, Ruby, and the Android platform a pleasant developer experience.Ruboto 1.2.0 · Community · Downloads · DocumentationMissing: 2010s | Show results with:2010s
  17. [17]
    JRuby 9.3.0.0 Released
    Sep 22, 2021 · The JRuby community is pleased to announce the release of JRuby 9.3.0.0. JRuby 9.3.x is compatible with Ruby 2.6.x and stays in sync with C Ruby.Jruby 9.3. 0.0 Released · Wednesday, September 22 2021 · Compatibility
  18. [18]
    Explanation of Warnings From MRI's Test Suite - Charles Oliver Nutter
    Sep 26, 2012 · JRuby has, for some time now, run the same test suite as MRI (C Ruby, Matz's Ruby). Because not all tests pass, we use minitest-excludes to ...
  19. [19]
    JRuby - Wikipedia
    JRuby is an implementation of the Ruby programming language atop the Java Virtual Machine, written largely in Java. It is free software released under a ...
  20. [20]
    JRuby 1.7.0. Released
    Oct 22, 2012 · You can enable invokedynamic use on Java 7, but it is disabled normally due to JVM issues. ... [JRUBY-6279] - Invokedynamic support is missing ' ...Missing: 2011 | Show results with:2011
  21. [21]
    JRuby 9.0.0.0 Released
    Jul 22, 2015 · JRuby 9.0.0.0 Released. Wednesday, July 22 2015. The JRuby community is pleased to announce the release of JRuby 9.0.0.0. Homepage: https://www ...Missing: date | Show results with:date
  22. [22]
    JRuby 9.4.0.0 Released
    Nov 23, 2022 · The JRuby community is pleased to announce the release of JRuby 9.4.0.0. The release of JRuby 9.4 represents a leap forward to Ruby 3.1 compatibility.Missing: history | Show results with:history
  23. [23]
    JRuby 10.0.1.0 Released
    Jul 17, 2025 · JRuby 10.0.1.0 Released. Thursday, July 17 2025. The JRuby community is pleased to announce the release of JRuby 10.0.1.0. Homepage ...Missing: 0.1 | Show results with:0.1
  24. [24]
    Downloads — JRuby.org
    Current Release: JRuby 10.0.2.0. JRuby 10.0.2.0 is our point release of our Ruby 3.4.x support. Please check out our release notes for more information.Missing: history | Show results with:history
  25. [25]
    JRubyInternalDesign · jruby/jruby Wiki - GitHub
    JRuby has a YACC/BISON-based parser, basically Ruby's parser ported to Java and using the Jay parser generated.
  26. [26]
    [PDF] JRuby - The Graal Workshop
    We are a Ruby implementation, but also a JVM language. • Core classes largely written in Java. • Parts of core and most of standard library in Ruby.
  27. [27]
    FAQs · jruby/jruby Wiki - GitHub
    Ruby 1.9 mode is default in JRuby 1.7.0 and later, 1.8.7 compatibility can still be used with the --1.8 flag. How do I run JRuby without the command-line ...
  28. [28]
    The Ruby Spec Suite Compatibility Report
    Jun 27, 2020 · JRuby currently runs and passes 8133 CRuby tests in CI. Opal and Artichoke do not seem to run CRuby tests currently. So it seems clear ...
  29. [29]
    C Extension Alternatives · jruby/jruby Wiki - GitHub
    Dec 24, 2020 · Use ffi-ncurses. ncurses is literal API and lower level than curses. fast_xor, use xorcist instead or roll slower but pure ruby equivalent.
  30. [30]
    Differences Between MRI and JRuby - GitHub
    Feb 16, 2020 · Although ideally MRI and JRuby would behave 100% the same in all situations, there are some minor differences. Some differences are due to bugs.Missing: alignment | Show results with:alignment
  31. [31]
    JRuby 10, Part 1: What's New
    Apr 9, 2025 · Published by Charles Oliver Nutter on April 09, 2025. I am very excited to introduce you to JRuby 10, our biggest leap forward since “JRuby 9000 ...Integrating With Jvm... · Ruby On The Jvm · Using Jvm LibrariesMissing: creators | Show results with:creators
  32. [32]
    PerformanceTuning · jruby/jruby Wiki - GitHub
    Enabling invokedynamic. Java 7 brings with it an important new feature called invokedynamic, which greatly improves JRuby's performance on VMs that support it.Missing: 2011 | Show results with:2011
  33. [33]
    JRuby 9.1.0.0 Released — JRuby.org
    May 3, 2016 · Truffle. JRuby 9000 includes an preliminary version of support for the Truffle language implementation framework and Graal JIT compiler from ...<|separator|>
  34. [34]
    Boosting JRuby Startup with AppCDS and AOT caching
    Feb 13, 2025 · JRuby and JDK24 AOTCache. So given our numbers above for JRuby startup, let's try JRuby with JDK24's AOT caching. First we need to run JDK24 ...Missing: classpath | Show results with:classpath
  35. [35]
    CallingJavaFromJRuby · jruby/jruby Wiki - GitHub
    JRuby, an implementation of Ruby on the JVM. Contribute to jruby/jruby development by creating an account on GitHub.Missing: creators | Show results with:creators
  36. [36]
    JRubyOnRailsWithSpring · jruby/jruby Wiki - GitHub
    These steps will get you from zero to a working JRuby on Rails app that can access Spring configured beans using maven to manage your dependencies.
  37. [37]
    Embedding with JSR 223 · jruby/jruby Wiki - GitHub
    Oct 2, 2013 · Embedding JRuby with JSR223 - Code Examples ; class Tree attr_reader ; package vanilla · import ; class Calculation include ; package vanilla · public ...
  38. [38]
    [PDF] Using JRuby - Pragmatic Bookshelf
    Instead, we recommend you use JSR 223 for non-Ruby-specific embed- ding projects, because of its official position as part of the JDK. CLICK HERE to ...
  39. [39]
    RedBridge · jruby/jruby Wiki - GitHub
    JRuby uses a mechanism called a variable map to track variable names and values between Ruby and Java. Various options control how this variable map is reused ...
  40. [40]
    Warbler chirpily constructs .war files of your Ruby applications.
    Warbler is a gem to make a Java jar or war file out of any Ruby, Rails or Rack application. Warbler provides a minimal, flexible, Ruby-like way to bundle up ...
  41. [41]
    org.springframework.scripting.jruby (Spring Framework API 2.5)
    Package org.springframework.scripting.jruby Description. Package providing integration of JRuby into Spring's scripting infrastructure.
  42. [42]
    The Ruby Sequel ORM on the Hibernate Connection Pool
    Jun 28, 2013 · We will demonstrate how to unify access to your database by leveraging the same connection in Java and JRuby.
  43. [43]
    jruby/jruby-maven-plugins - GitHub
    maven plugin to handle rubygems in a maven way. including support for rspec, rails, cucumber, rake, etc - jruby/jruby-maven-plugins.
  44. [44]
    A Gradle plugin for working with JRuby projects for fun and ... - GitHub
    With JRuby/Gradle you can specify your Java and Ruby dependencies together, build jar files, run tests, and much more!
  45. [45]
    org.apache.servicemix.bundles.jruby - Maven Repository
    Building Modular Cloud Apps with OSGi: Practical Modularity with Java in the Cloud Age (2013) by Bakker, Paul, Ertman, Bert.
  46. [46]
    JRuby Options - GitHub
    Oct 30, 2019 · JRuby uses a number of JVM properties to help users configure the way it should operate. Most of these properties can be written in a shorthand command-line ...
  47. [47]
    A Guide to Java Profilers | Baeldung
    May 11, 2024 · In this tutorial, we'll explore the main Java Profilers: JProfiler, YourKit, Java VisualVM, the Netbeans Profiler, and the IntelliJ Profiler. 2.
  48. [48]
    VisualVM - Oracle Help Center
    JFR is a tool for collecting diagnostic and profiling data about a running Java application. It is integrated into the Java Virtual Machine (JVM) and causes ...Missing: JRuby | Show results with:JRuby
  49. [49]
    The State of JRuby: 1.5, AOT, Java 7 - InfoQ
    Jun 2, 2010 · InfoQ What's the status of FFI and other methods for accessing native libraries? In JRuby 1.5, we switched away from JNA (Java Native Access) ...
  50. [50]
    What do multi-processes VS multi-threaded servers most benefit from?
    Sep 2, 2013 · JRuby is pretty speedy, and while Rubinius is slow compared to MRI, multithreaded Rubinius processes data faster than MRI.Does ruby have real multithreading? - Stack OverflowHow does one achieve parallel tasks with Ruby's Fibers?More results from stackoverflow.comMissing: fibers | Show results with:fibers
  51. [51]
    README - Sinatra
    Sinatra should work on any operating system supported by the chosen Ruby implementation. Running Sinatra on a not officially supported Ruby flavor means ...
  52. [52]
    trinidad/trinidad: Web server for Rails/Rack applications ... - GitHub
    Aug 20, 2024 · Trinidad allows you to run Rails and/or Rack applications within an embedded Tomcat container. Apache Tomcat (formerly also Jakarta Tomcat) is an open source ...
  53. [53]
    Testing Rails Applications - Ruby on Rails Guides
    If you prefer using threads or are using JRuby, a threaded parallelization option is provided. The threaded parallelizer is backed by minitest's Parallel:: ...
  54. [54]
  55. [55]
    JRuby/Windows and (native) extensions how do I distinguish them?
    Feb 8, 2009 · JRuby does not support native extensions, unfortunately, because they depend on specific memory and runtime details specific to the C implementation.Missing: FFI | Show results with:FFI
  56. [56]
    FFI for Ruby Now Available - Charles Oliver Nutter
    Oct 31, 2008 · Our hope with JRuby's support of FFI and our release of FFI for C Ruby is that we may finally escape the hell of C extensions. Next time you ...Missing: limitations | Show results with:limitations
  57. [57]
    Deploying Rails with JRuby to Heroku - Kevin Sylvestre
    Nov 16, 2012 · Step 1: Modify Your Gemfile · Step 2: Modify Your Procfile · Step 3: Configure Your Application · Step 4: Deploy.
  58. [58]
    JRuby on Rails on Amazon Elastic Beanstalk - Charles Oliver Nutter
    Jan 19, 2011 · Amazon this week announced Elastic Beanstalk, a managed Apache Tomcat service for AWS. Naturally, I had to try JRuby on it.
  59. [59]
    Ruby | IntelliJ IDEA Documentation - JetBrains
    Jun 26, 2025 · The Ruby plugin extends IntelliJ IDEA with the full-scale functionality for Ruby development. The plugin supports the same functionality as RubyMine.
  60. [60]
    Compare IntelliJ IDEA Ultimate vs. RubyMine - JetBrains IDE
    RubyMine and the Ruby plugin for IntelliJ IDEA have the same functionality. The main difference is that RubyMine is designed specifically for Ruby developers ...
  61. [61]
    VSCode rdbg Ruby Debugger - Visual Studio Marketplace
    Without any configuration, you can use this debugger by "Start Debugging" (F5 key) if you activate .rb file. You will see the "Debug command line" input dialog.
  62. [62]
    org.jruby:jruby-complete - Maven Central - Sonatype
    Discover jruby-complete in the org.jruby namespace. Explore metadata, contributors, the Maven POM file, and more.Missing: tools IRB Rake
  63. [63]
    Chat with the JRuby Community
    To join, visit the Matrix #jruby room and select a client that suits you. The Matrix #jruby logs are also publically readable. The Matrix room also bridges to ...Missing: Slack | Show results with:Slack
  64. [64]
    Documentation — JRuby.org
    Docs and Articles. API Docs. Browse JRuby API Javadocs online. We greatly appreciate patches and pull requests for documentation updates.
  65. [65]
    Ruby Conferences
    RubyEvents.org is a simple list of Ruby-specific conferences, published collaboratively with the Ruby community. There you will find event dates, location, CFP ...