JRuby 1.6.7 更新版本发布了,该版修复了Ruby 1.9 的一些兼容性问题,在性能方面也有不少改善,值得关注的变化有:
- Fix circular require issue in Rubygems introduced by our Maven gem support
- Fix regression in popen* where streams get prematurely closed
- Many 1.9-mode encoding bugs fixed in String, Regexp, StringIO, and YAML
- Win32OLE now works in 1.9-mode
- ffi on Win x64 now knows about basic types :size_t
- Use jzlib to fix a set of issues with out zlib library
- Reduced internal locking based on user reports
- C extensions work on OS X again
- Gems with gemspecs which contain UTF-8 multi-byte chars install in 1.9 mode
完整的列表请看:full list of resolved issues
JRuby是面向Ruby、基于Java虚拟机(JVM)的一种解释程序,它结合了Ruby语言的简易性和功能强大的JVM的执行机制,包括与Java库 全面集成。Rails彻底加快及简化了Web应用的开发,不过它让人觉得不够成熟,特别是在高端企业级功能方面。另一方面,Java平台及其虚拟机、库和 应用服务器的速度、稳定性和功能方面却一直在提升,现在已被公认为是开发高端服务器应用的领先平台。不过如果Java平台不与Ruby等新兴语言联系在一 起,就有可能落后于流行趋势。
示例代码:
require "java"
include_class "java.util.TreeSet"
include_class "com.example.CallMe"
include_class "com.example.ISpeaker"
puts "Hello from ruby"
set = TreeSet.new
set.add "foo"
set.add "Bar"
set.add "baz"
set.each { |v| puts "value: #{v}" }
cm = CallMe.new
cm.hello
$globalCM.hello
class CallJava
include ISpeaker
def initialize
super
@count = 0
end
def say(msg)
puts "Ruby saying #{msg}"
end
def addOne(from)
# m.synchronize {
@count += 1
puts "Now got #@count from #{from}"
# }
end
end
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
下载地址:http://jruby.org/download
【编辑推荐】