Introduction to Java-based Ruby interpreter JRuby

Source: Internet
Author: User

Rails accelerates and simplifies the development of Web applications, but it makes people feel immature, especially in terms of high-end enterprise-level functions. On the other hand, the speed, stability, and functions of the Java platform and its virtual machines, libraries, and application servers have been improved. It is now recognized as a leading platform for developing high-end server applications. However, if the Java platform is not associated with emerging languages such as Ruby, it may fall behind the popular trend.

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. newset. add "foo" set. add "Bar" set. add "baz" set. each {| v | puts "value: # {v}"} cm = CallMe. newcm. hello $ globalCM. helloclass CallJavainclude ISpeakerdef initialize super @ count = 0 enddef say (msg) puts "Ruby saying # {msg}" enddef addOne (from) # m. synchronize {@ count + = 1 puts "Now got # @ count from # {from}" #} endend

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.