简体   繁体   English

使用JRuby或Python来调用某些第三方Java库 - 架构问题

[英]Using JRuby or Python to call some 3rd party Java libraries - architecture question

I am evaluating what I will use on the front and back ends of a project. 我正在评估我将在项目的前端和后端使用什么。 I definitely will need to use some 3rd party Java libraries, but I am curious whether there is a nice way to do the front and back-end layer in something like Ruby or Python? 我肯定需要使用一些第三方Java库,但我很好奇是否有一种很好的方法来处理像Ruby或Python这样的前端和后端层?

Or is it possible to just call the Java libraries from Ruby/Python and avoid programming using Java alltogether? 或者是否可以从Ruby / Python中调用Java库并避免使用Java进行编程? :) :)

All of these run on Tomcat, and are deployed using a .war file, correct? 所有这些都在Tomcat上运行,并使用.war文件进行部署,对吗?

I know for a fact that you can call all your Java libraries using JRuby. 我知道您可以使用JRuby调用所有Java库。 You can use the ruby programming language on your front and back end via Rails (Rails is a framework written in ruby). 您可以通过Rails在前端和后端使用ruby编程语言(Rails是一个用ruby编写的框架)。

The difference between MRI (Matz Ruby) and JRuby is that JRuby runs on the JVM, whereas MRI has its own VM which is different from the JVM. MRI(Matz Ruby)和JRuby之间的区别在于JRuby在JVM上运行,而MRI有自己的VM,它与JVM不同。

By running on the JVM, you gain access to a whole lot of Java libraries. 通过在JVM上运行,您可以访问大量Java库。

Any JVM based language will allow you to use your java libraries while writing your code in your language of choice. 任何基于JVM的语言都允许您在使用您选择的语言编写代码时使用Java库。 So, you can use JRuby (ruby on the JVM), Jython (python on the jvm), Groovy, Scala, Clojure. 因此,您可以使用JRuby(JVM上的ruby),Jython(jvm上的python),Groovy,Scala,Clojure。

You will be able to deploy all of those to tomcat using war file. 您将能够使用war文件将所有这些部署到tomcat。

Your actual choice of language depends on your requirements. 您实际选择的语言取决于您的要求。 Clojure is a lot like Lisp, so if you're into that it's worth looking into, very impressive. Clojure很像Lisp,所以如果你进入它,它值得研究,非常令人印象深刻。 Scala is getting quite a lot of visibility and is equally strong in functional and OO, it also has a very nice web framework called Lift worth considering. Scala获得了很多可见性,在功能和OO方面同样强大,它还有一个非常好的Web框架,名为Lift值得考虑。 Groovy is pretty mature now and has grails if you like rails-like framework. Groovy现在非常成熟,如果你喜欢类似rails的框架,那就有grails。 Of course you can't really go wrong with JRuby on Rails, the JRuby project is very active and well supported. 当然,JRuby on Rails确实不会出错,JRuby项目非常活跃且得到很好的支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM