JRuby
Developer(s) | Charles Nutter, Thomas Enebo, Ola Bini and Nick Sieger |
---|---|
Stable release | 1.4.0 / November 2, 2009 |
Written in | Ruby and Java |
Operating system | Cross-platform |
Platform | Java Virtual Machine |
Type | Ruby programming language interpreter |
License | CPL/GPL/LGPL |
Website | http://www.jruby.org/ |
JRuby is a Java implementation of the Ruby programming language, being developed by the JRuby team. It is free software released under a three-way CPL/GPL/LGPL license. JRuby is tightly integrated with Java to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code (similar to Jython for the Python language).
JRuby's lead developers are Charles Nutter, Thomas Enebo, Ola Bini and Nick Sieger. In September 2006, Sun Microsystems hired Enebo and Nutter to work on JRuby full time.[1] In June 2007, ThoughtWorks hired Ola Bini to work on Ruby and JRuby.[2] In July 2009, the JRuby developers left Sun to continue JRuby development at Engine Yard.[3]
History
Template:Cleanup-section JRuby was originally created by Jan Arne Petersen, in 2001. At that time and for several years following, the code was a direct port of the Ruby 1.6 C code. With the release of Ruby 1.8.6, an effort began to update JRuby to 1.8.6 features and semantics. Since 2001, several contributors have assisted the project, leading to the current (2008[update]) core team of four members.
The Netbeans Ruby Pack, available since NetBeans 6.0, allows IDE development with Ruby and JRuby, as well as Ruby on Rails for the two implementations of Ruby.[4][5]
JRuby 1.1 added Just-in-time compilation and Ahead-of-time compilation modes to JRuby and was already faster in most cases than the current Ruby 1.8.7 reference implementation[6].
JRuby 1.1.1 is stated to be packaged in Fedora 9[7][8].
Since version 1.1.1, the JRuby team began to issue point releases often to quickly address issues that are brought up by users[9].
On July 2009, the core JRuby developers, Charles Nutter, Thomas Enebo and Nick Sieger, joined Engine Yard to continue JRuby development.[3][10]
JRuby initially supported Ruby MRI 1.8.6, and gradually improved its Ruby 1.9 support[11]. Since 1.4.0 it also supported Ruby 1.8.7.
Rails
JRuby supports Ruby on Rails since version 0.9 (May 2006) [12][13], with the ability to execute RubyGems and WEBrick. Since the hiring of the two lead developers by Sun, Rails compatibility and speed have improved greatly. JRuby version 1.0 successfully passed nearly all of Rails' own test cases[14]. Since then, developers have begun to use JRuby for Rails applications in production environments [15].
Multiple virtual machine collaboration
On February 27, 2008, Sun Microsystems and the University of Tokyo announced a joint-research project to implement a virtual machine capable of executing more than one Ruby or JRuby application on one interpreter[16].
Dynamic invocation on Java Virtual Machines
JSR 292 (Supporting Dynamically Typed Languages on the JavaTM Platform) [17] propose to:
- add a new
invokedynamic
instruction at the JVM level, to allow method invocation relying on dynamic type checking, - to be able to change the classes and methods at runtime dynamically in a production environment.
The Sun Open source project Multi Language Virtual Machine aim to prototype this JSR[18]. The first working prototype, developed as a patch on OpenJDK, was announced and made available on end of August 2008[19][20].
The JRuby team has successfully wired dynamic invocation in their codebase, albeit in a very primitive way. Dynamic invocation shipped with the 1.1.5 release, although being disabled on JVMs without Dynamic invocation capabilities[21].
Release history
This table present only releases that present significant steps in JRuby history, aside from versions that mainly fixed bugs and improved performance.
Release | Release Date | Highlights |
---|---|---|
0.9 | 2006-08-01 | Rails support[12] |
1.1 | 2008-03-28 | Performs better than Ruby MRI 1.8.7[6] AOT mode and JIT mode[22] |
1.1.4 | 2008-08-28 | Refactored Java integration layer Beginning of Ruby 1.9 support FFI subsystem for calling C libraries[23] |
1.2.0[24] | 2009-03-16 | Ruby 1.9 support almost complete (including JIT compiler) Preliminary Android support |
1.3.0[25] | 2009-06-03 | JRuby runs in restricted environments better like GAE/J Performance improvement |
1.4.0[26][27] | 2009-11-02 | Windows Native Launcher and Windows installer Ruby 1.8.7 support Improved Ruby 1.9 support |
Design
Since early 2006, the current JRuby core team has endeavored to move JRuby beyond being a simple C port, to support better performance and to aid eventual compilation to Java bytecode. To support this end, the team set an ambitious goal: to be able to run Ruby on Rails unmodified using JRuby. In the process of achieving this goal, the JRuby test suite expanded to such extent that the team gained confidence in the "correctness" of JRuby. As a result, toward the end of 2006 and in the beginning of 2007, they began to commit much more complicated redesigns and refactorings of JRuby's core subsystems.
JRuby is designed to work as a mixed-mode virtual machine for Ruby, where code can be either interpreted directly, just-in-time compiled at runtime to Java bytecode, or ahead-of-time compiled to Java bytecode before execution. Until October 2007, only the interpreted mode supported all Ruby's constructs, but a full AOT/JIT compiler is available since version 1.1[22]. The compiler design allows for interpreted and compiled code to run side-by-side, as well as decompilation to reoptimize and outputting generated bytecode as Java class files.
Frameworks support
JRuby has built-in support for Rails, RSpec, Rake, and RubyGems. It embeds an FFI subsystem to allow to use C libraries bundled as gems.
It also allows to launch the Interactive Ruby Shell (irb) as Ruby MRI does.
Programming
Ruby meets Java
JRuby is essentially the Ruby interpreter, except this version is written entirely in Java. JRuby features some of the same concepts, including object-oriented programming, and duck-typing as Ruby. The key difference is that JRuby is tightly integrated with Java, and can be called directly from Java programs[28].
Calling Java from JRuby
One powerful feature of JRuby is its ability to invoke the classes of the Java Platform. To do this, one must first load JRuby's Java support, by calling "include Java" ("require 'java'" in earlier versions). The following example creates a Java Template:Javadoc:SE with a Template:Javadoc:SE:
include Java
frame = javax.swing.JFrame.new()
frame.getContentPane().add(javax.swing.JLabel.new('Hello, World!'))
frame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
frame.pack()
frame.set_visible(true)
JRuby also allows the user to call Java code using the more Ruby-like underscore method naming and to refer to JavaBean properties as attributes:
frame.content_pane.add label
frame.visible = true
Calling JRuby from Java
JRuby can just as easily be called from Java, using either the JSR 223[29] Scripting for Java 6 or the Apache Bean Scripting framework. More information on this is available in the JRuby Wiki article.
Performance
JRuby supports interpreted mode, AOT mode, and JIT mode (the last two modes are available since version 1.1[22]). JRuby evolved from being several times slower than Ruby Reference implementation[30], to being several times faster.[31] [32] Benchmarks as of 16 December 2009, show JRuby using between 2 and 56 times the memory of Ruby MRI.[32]
Interpreted mode
In this mode, JRuby 1.0 was slower than the C Ruby reference[33]. For example, serving up Rails requests in the standard interpreted mode, JRuby was 50% to 70% slower than C Ruby 1.8. Since then, JRuby performance in interpreted mode has improved a lot. The JRuby team claims that JRuby 1.1.4 is 15%-20% faster in interpreted mode than Ruby MRI [34].
When using Ruby 1.9 (YARV) benchmarks on Java 6, interpreted JRuby 1.0 was 4 times slower than Ruby (including startup time).
Just-in-time compilation mode
JIT mode is available since JRuby 1.1. In performance benchmarks, JRuby is consistently 200% to 300% faster than C Ruby 1.8.6 [31] but still 15%-25% slower than C Ruby 1.9. However, the JRuby 1.1.6 version outperforms C Ruby 1.9 in some cases [35][36] [37].
Also in a real Mongrel web server application, JRuby performance is better than Ruby (after the Virtual Machine has instantiated)[38].
See also
- Jython
- YARV
- RubyJS and HotRuby
- ZK (framework) – an Ajax framework supporting JRuby
- Monkeybars Framework
- Da Vinci Machine
References
- ↑ Jacki (2006-09-07). "Sun Welcomes JRuby Developers". On the Record. http://blogs.sun.com/ontherecord/entry/sun_welcomes_jruby_developers. Retrieved 2006-09-09.
- ↑ Ola Bini. "ThoughtWorks". On the Record. http://ola-bini.blogspot.com/2007/03/thoughtworks.html.
- ↑ 3.0 3.1 "Sun's JRuby team jumps ship to Engine Yard". 2009-07-27. http://www.itworld.com/business/72663/suns-jruby-team-jumps-ship-engine-yard. Retrieved 2009-07-28.
- ↑ "Ruby & JRuby Support Available in NetBeans IDE". netbeans.org. 2007-03-06. http://www.netbeans.org/servlets/NewsItemView?newsItemID=1015. Retrieved 2009-07-04.
- ↑ "Ruby brightens the NetBeans platform". infoworld.com. 2007-03-01. http://www.infoworld.com/d/developer-world/ruby-brightens-netbeans-platform-390. Retrieved 2008-07-04.
- ↑ 6.0 6.1 Cangiano, Antonio (2007-03-12). "The Great Ruby Shootout". http://antoniocangiano.com/2007/12/03/the-great-ruby-shootout/. Retrieved 2008-02-01.
- ↑ Nutter, Charles (2008-04-25). "JRuby 1.1.1 in RedHat Fedora". http://headius.blogspot.com/2008/04/jruby-111-in-redhat-fedora.html. Retrieved 2008-04-26.
- ↑ "jruby". fedoraproject.org. https://admin.fedoraproject.org/pkgdb/packages/name/jruby. Retrieved 2008-04-26.
- ↑ "JRuby 1.1.3 Released". jruby.codehaus.org. 2008-07-19. http://docs.codehaus.org/display/JRUBY/2008/07/19/JRuby+1.1.3+Released. Retrieved 2008-07-19. "Our goal is to put out point releases more frequently for the next several months (about 3–4 weeks a release). We want a more rapid release cycle to better address issues brought up by users of JRuby."
- ↑ Nutter, Charles (2009-07-28). "JRuby’s Future at Engine Yard". http://www.engineyard.com/blog/2009/jrubys-future-at-engine-yard/. Retrieved 2009-07-28.
- ↑ "Ruby Future Roundup: Ruby 1.9.0-5 Released, JRuby Skips 1.8.7". infoq.com. 2008-10-08. http://www.infoq.com/news/2008/10/ruby-future-roundup-1.9.0-5. Retrieved 2008-12-06. "Most 1.8.7 features that came from 1.9.1 are to make transition from 1.8 to 1.9 series easier(...)users should switch directly to 1.9 rather then writing code that only works in 1.8.7 "
- ↑ 12.0 12.1 "Rails Support". JRuby Team. http://wiki.jruby.org/wiki/Rails_Support. Retrieved 2008-02-17.
- ↑ Nutter, Charles (2008-08-24). "Zero to Production in 15 Minutes". http://blog.headius.com/2008/08/zero-to-production-in-15-minutes.html. Retrieved 2008-08-27.
- ↑ 98.6% of the 2,807 Rails-specific test cases execute successfully; see JRuby 0.9.8 Released
- ↑ "Success Stories". JRuby Wiki. 2008-01-29. http://wiki.jruby.org/wiki/Success_Stories. Retrieved 2008-02-17.
- ↑ "The University of Tokyo and Sun Microsystems Commence Joint Research Projects on High Performance Computing and Web-based Programming Languages". Sun Microsystems. 2008-02-27. http://www.sun.com/aboutsun/pr/2008-02/sunflash.20080227.5.xml. Retrieved 2008-02-28.
- ↑ see JSR 292
- ↑ "Sub-Projects and Investigations". Sun Microsystems. 2007. http://openjdk.java.net/projects/mlvm/subprojects.html. Retrieved 2008-02-06.
- ↑ Rose, John (2008-08-26). "Happy International Invokedynamic Day!". http://blogs.sun.com/jrose/entry/international_invokedynamic_day. Retrieved 2008-09-03.
- ↑ Lorimer, R.J. (2008-09-01). "Dynamic Invocation Runs on OpenJDK". infoq.com. http://www.infoq.com/news/2008/09/invokedynamic_day. Retrieved 2008-09-03.
- ↑ Nutter, Charles (2008-09-11). "A First Taste of InvokeDynamic". http://blog.headius.com/2008/09/first-taste-of-invokedynamic.html. Retrieved 2008-09-13. "I managed to successfully wire InvokeDynamic directly into JRuby's dispatch process! Such excitement! The code is already in JRuby's trunk, and will ship with JRuby 1.1.5 (though it obviously will be disabled on JVMs without InvokeDynamic)."
- ↑ 22.0 22.1 22.2 Nutter, Charles (2007-09-27). "The Compiler Is Complete". http://headius.blogspot.com/2007/09/compiler-is-complete.html. Retrieved 2007-10-12.
- ↑ Enebo, Tom (2008-08-28). "JRuby 1.1.4 Released". http://www.bloglines.com/blog/ThomasEEnebo/2008_8. Retrieved 2009-02-25.
- ↑ Enebo, Tom (2009-03-16). "JRuby 1.2.0 Released". JRuby Team. http://docs.codehaus.org/display/JRUBY/2009/03/16/JRuby+1.2.0+Released. Retrieved 2009-03-17.
- ↑ Enebo, Tom (2009-06-03). "JRuby 1.3.0 Released". JRuby Team. http://docs.codehaus.org/display/JRUBY/2009/06/03/JRuby+1.3.0+Released. Retrieved 2009-06-03.
- ↑ "JRuby 1.4.0 Released". JRuby Team. 2009-11-02. http://www.jruby.org/2009/11/02/jruby-1-4-0. Retrieved 2009-11-03.
- ↑ "JRuby 1.4.0 Released". adtmag.com. 2009-11-10. http://adtmag.com/articles/2009/11/10/jruby-1.4-released.aspx. Retrieved 2009-11-21.
- ↑ Fox, Joshua (2006-07-17). "Script your Java applications and efficiently reuse your Java libraries with this dynamic language". JavaWorld. http://www.javaworld.com/javaworld/jw-07-2006/jw-0717-ruby.html. Retrieved 2008-04-26.
- ↑ JSR 223: Scripting for the Java Platform Specification Request
- ↑ Cangiano, Antonio (2007-02-19). "Ruby Implementations Shootout: Ruby vs Yarv vs JRuby vs Gardens Point Ruby .NET vs Rubinius vs Cardinal". http://antoniocangiano.com/2007/02/19/ruby-implementations-shootout-ruby-vs-yarv-vs-jruby-vs-gardens-point-ruby-net-vs-rubinius-vs-cardinal/. Retrieved 2008-12-14.
- ↑ 31.0 31.1 Cangiano, Antonio (2008-12-09). "The Great Ruby Shootout (December 2008)". http://antoniocangiano.com/2008/12/09/the-great-ruby-shootout-december-2008/. Retrieved 2008-12-14.
- ↑ 32.0 32.1 "JRuby compared to Ruby 1.8, Computer Language Benchmarks Game". http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=jruby&lang2=ruby&box=1. Retrieved 2009-10-19.
- ↑ Nutter, Charles (2007-04-16). "Paving the Road to JRuby 1.0: Performance". http://headius.blogspot.com/2007/04/paving-road-to-jruby-10-performance.html. Retrieved 2007-11-05.
- ↑ Nutter, Charles (2008-04-27). "Promise and Peril for Alternative Ruby Impls". http://blog.headius.com/2008/04/promise-and-peril-for-alternative-ruby.html. Retrieved 2008-12-06. "We now run faster than Ruby 1.8 in both interpreted and compiled modes, with interpreted being perhaps 15-20% faster and compiled being at least a few times faster, generally on par with Ruby 1.9"
- ↑ Nutter, Charles (2008-11-23). "Noise Cancelling". http://blog.headius.com/2008/11/noise-cancelling.html. Retrieved 2008-12-07. "A year ago, we were generally a bit slower than Ruby 1.8.6; this year, we're faster in most cases than Ruby 1.9."
- ↑ Nutter, Charles (2008-02-16). "JRuby RC2 Released; What's Next?". http://headius.blogspot.com/2008/02/jruby-rc2-released-whats-next.html. Retrieved 2008-02-17. "JRuby's performance regularly exceeds Ruby 1.8.6, and in many cases has started to exceed Ruby 1.9."
- ↑ "JRuby compared to Ruby 1.9, Computer Language Benchmarks Game". http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=jruby&lang2=yarv&box=1. Retrieved 2009-10-19.
- ↑ Sieger, Nick (2007-10-25). "JRuby on Rails: Fast Enough". http://blog.nicksieger.com/articles/2007/10/25/jruby-on-rails-fast-enough. Retrieved 2007-10-28.
Bibliography
- Edelson, Justin; Liu, Henry (November 18, 2008), JRuby Cookbook (First ed.), O'Reilly Media, pp. 222, ISBN 059651980X, http://oreilly.com/catalog/9780596519803/
- Bini, Ola (September 24, 2007), Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java (First ed.), Apress, pp. 330, ISBN 1590598814, http://apress.com/book/view/9781590598818
- Kutler, Chris; Leonard, Brian (May 4, 2009), NetBeans Ruby and Rails IDE with JRuby (First ed.), Apress, pp. 160, ISBN 1430216360, http://www.apress.com/book/view/1430216360
External links
This article's external links may not follow Wikipedia's policies or guidelines. Please improve this article by removing excessive and inappropriate external links or by converting links into references. (June 2009) |
- The JRuby home page
- The JRuby Wiki
- JRubyHub.com: The hub for all resources related to JRuby and JRuby on Rails (JRoR)
- JRubyonRails.de: JRuby on Rails Blog (german)
- Joshua Fox, "Ruby for the Java world", JavaWorld
- JRuby Roadmap for 2007
- The Great Ruby Shootout: JRuby compared to other Ruby VMs
- Article on JRuby at IBM DeveloperWorks
- Joshua Fox, "JRuby on Rails", JavaWorld
- Scripting on the Java platform, JavaWorld
- JRuby development in NetBeans
- Deploying a Rails Application in Tomcat
- Calling Ruby’s ActiveRecord from Java Using the Bean Scripting Framework
- Deploying JRuby on Rails application on Sun Java System Web Server 7
- Easy to install distribution of JRuby, Tomcat and Glassfish
- Arun's Flash Demo: First JRuby app in GlassFish V2
- First JRuby app in GlassFish V3
- JRuby on Rails Blog (german)
Media
- JRuby: The power of Java and Ruby at YouTube
- JavaOne 2007 Exploiting JRuby
- JavaOne 2007 JRuby on Rails
- Roumen's Ruby Flash Demo (Part One): JRuby on Rails in NetBeans
- Roumen's Ruby Flash Demo (Part Two): Advanced JRuby editing features in NetBeans
- Java Posse, Interview with Charles Oliver Nutter and Thomas Enebo about JRuby
- A presentation by Charles Nutter introducing JRuby, from QCon San Francisco 2007
- An interview with Charles Nutter about several aspects of JRuby, from QCon San Francisco 2007
- A presentation by Ola Bini about JRuby's implementation and optimization, from QCon London 2008
- An interview with Nick Sieger about JRuby, from RubyFringe 2008
- A presentation by Charles Nutter about JRuby internal details and future development, from the Sun JVM Languages Summit 2009
|
de:JRuby es:JRuby fr:JRuby ja:JRuby pt:JRuby ru:JRuby zh-yue:JRuby
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...
- Pages where expansion depth is exceeded
- Pages using deprecated source tags
- Pages with syntax highlighting errors
- Articles containing potentially dated statements from 2008
- Articles with invalid date parameter in template
- All articles containing potentially dated statements
- Pages with broken file links
- Wikipedia external links cleanup
- Wikipedia spam cleanup
- Exclude in print
- Free software programmed in Java
- Free software programmed in Ruby
- JVM programming languages
- Scripting languages
- Object-oriented programming languages