Introduction to the Java version of the Ruby interpreter JRuby _ruby topics

Source: Internet
Author: User

Rails accelerates and simplifies the development of Web applications, but it's not mature enough, especially at high-end enterprise-level features. On the other hand, the Java platform and its virtual machines, libraries, and application servers have been upgraded in speed, stability and functionality, and are now recognized as the leading platform for high-end server applications. However, if the Java platform is not associated with emerging languages such as Ruby, it is likely to lag behind in fashion trends.

Sample code:

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.