如果我安装了Rails上的jRuby,我可以只使用Ruby吗?

时间:2021-12-31 07:01:07

What I mean by this is if I install jRuby on Rails, can I use only the ruby language to build my application? I wanted to install my rails application with jRuby in case I wanted to use Java in the future, though I don't need it now. Or do I not understand? Is jRuby ruby that has access to java libraries?

我的意思是,如果我在Rails上安装jRuby,我可以只使用ruby语言来构建我的应用程序吗?我想用jRuby安装我的rails应用程序,以防我以后想要使用Java,尽管我现在不需要它。或者我不明白? jRuby ruby​​是否可以访问java库?

2 个解决方案

#1


yes, jruby is ruby (your ruby scripts need no modification to run under jruby). in addition, it has full access to java libraries - check out the wiki for how easy it is to integrate a java class or library into your ruby code.

是的,jruby是ruby(你的ruby脚本不需要修改就可以在jruby下运行)。此外,它可以完全访问java库 - 查看wiki,了解将java类或库集成到ruby代码中是多么容易。

#2


The others have answered your direct question. I just want to say that I've been using jruby full time at work for the past 6 months and it's great. Deploying a rails app with the glassfish gem is very easy and jruby performs better than MRI ruby 1.8.x.

其他人已经回答了你的直接问题。我只想说在过去的6个月里我一直在使用jruby全职工作,这很棒。使用glassfish gem部署rails应用程序非常容易,jruby比MRI ruby​​ 1.8.x更好。

I've seen no real downside after 6 months other than the fact that we can't use gems that have pieces written in C. However, we've taken a C library and created a gem using FFI and it wasn't too much trouble.

6个月之后我没有看到真正的缺点,除了我们不能使用有C编写的碎片的事实。但是,我们已经使用了一个C库并使用FFI创建了一个宝石,并没有太多麻烦。

It's also really easy to speed up your app by writing a few key pieces in java (which is easier t work with than C).

通过在java中编写一些关键部分来加速应用程序也很容易(这比使用C更容易)。

#1


yes, jruby is ruby (your ruby scripts need no modification to run under jruby). in addition, it has full access to java libraries - check out the wiki for how easy it is to integrate a java class or library into your ruby code.

是的,jruby是ruby(你的ruby脚本不需要修改就可以在jruby下运行)。此外,它可以完全访问java库 - 查看wiki,了解将java类或库集成到ruby代码中是多么容易。

#2


The others have answered your direct question. I just want to say that I've been using jruby full time at work for the past 6 months and it's great. Deploying a rails app with the glassfish gem is very easy and jruby performs better than MRI ruby 1.8.x.

其他人已经回答了你的直接问题。我只想说在过去的6个月里我一直在使用jruby全职工作,这很棒。使用glassfish gem部署rails应用程序非常容易,jruby比MRI ruby​​ 1.8.x更好。

I've seen no real downside after 6 months other than the fact that we can't use gems that have pieces written in C. However, we've taken a C library and created a gem using FFI and it wasn't too much trouble.

6个月之后我没有看到真正的缺点,除了我们不能使用有C编写的碎片的事实。但是,我们已经使用了一个C库并使用FFI创建了一个宝石,并没有太多麻烦。

It's also really easy to speed up your app by writing a few key pieces in java (which is easier t work with than C).

通过在java中编写一些关键部分来加速应用程序也很容易(这比使用C更容易)。