Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting rails to java

I have a ruby on rails application and thinking about porting it to java. What are the things I should consider before that? How hard is that task in terms of changes required?

Any advice from the people who have walked this path is greatly appreciated.

Motivation: I have two web applications using same data. One is in java, another - rails. As a result, they both have databases and lots of stuff is sent back and forth and stored in copied tables. As an addition it is extremly slow. I can't move java to RoR, so thinking about what it'll take to move RoR to java (jvm that is).

like image 384
clorz Avatar asked Jul 11 '26 00:07

clorz


2 Answers

If I were in your position, I would try running your Ruby code in JRuby which is an implementation of Ruby that runs on the JVM. It supports rails, which means you should be able to take your code and run it on the JVM.

Once that's done, you can start writing new features in java, and it should work with your old code transparently. You can also begin the task of rewriting some of your code in Java, without breaking comparability.

like image 74
Chad Okere Avatar answered Jul 13 '26 12:07

Chad Okere


What's the motivation for porting this ?

If you need to integrate with Java libraries, there are numerous options available other than porting the whole app to Java.

If you need a direct port, then (as Chad has illustrated) JRuby may be the way to go.

If you want to do a complete rewrite, but keep the RoR paradigm, check out Grails, which is a JVM-based RoR equivalent using Groovy (a Java Virtual Machine-compatible language that allows you to bind in Java libraries)

like image 35
Brian Agnew Avatar answered Jul 13 '26 12:07

Brian Agnew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!