Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Ruby as cross-platform as Java?

You can compile a Java application and run it in any machine where the Java virtual machine is located, independently of the underlying hardware.

Since Ruby on Rails was built upon Ruby, I'm concerned if building software in Ruby in any environment is the same or not. There exists versions of Ruby for Windows, Linux and Mac at least.

So, could you do the same with a Ruby application and with a Java application? In other words, how cross-platform is Ruby?

EDIT: I mean Ruby by itself, not Ruby running in another virtual machine like in jRuby. Should I expect more cross-platform gotchas development in Ruby than in Java or are both almost the same?

like image 810
eKek0 Avatar asked Aug 21 '09 04:08

eKek0


People also ask

Is Ruby a cross platform language?

I wouldn't consider ruby cross platform. The platform relies on a whole host of dependencies, which anytime one of them uses anything platform specific the whole thing breaks. i.e. see this error: ExecJS::RuntimeError on Windows trying to follow rubytutorial

What is the difference between Java platform and Ruby?

The Java platform is a collection of programs that helps develop and run programs written in the Java programming language. Java platform also includes an execution engine, compiler and a set of libraries. Ruby is a scripting language.

Is Java cross-platform?

Java is cross platform. Ruby is not. It very much feels like an afterthought of, "oh we have windows users, let's try and get it working". In Java I have experienced less than 10 cross platform issues in years of heavy use. The areas that this was in, were obviously areas that would be tricky. System/File system specifics.

Can you build software in Ruby on rails in any environment?

You can compile a Java application and run it in any machine where the Java virtual machine is located, independently of the underlying hardware. Since Ruby on Rails was built upon Ruby, I'm concerned if building software in Ruby in any environment is the same or not. There exists versions of Ruby for Windows, Linux and Mac at least.


2 Answers

Ruby is a scripting language and it is interpreted at the run time by the Ruby interpreter , The Ruby code is interpreted and converted to machine level language i.e Assembly code . Talking about the platform Independence you can run ruby code in any of the the platform like Linux ,Windows or Mac if you have platform dependent Ruby Interpreter installed.

Where as in Java , it is Compiled and converted to an intermediate byte class and this byte class is interpreted by platform dependent JVM (Java Virtual Machine ) .

In that way you can think you Ruby source file as byte class which can be run on any platform ,with one difference byte class is already compiled but ruby source file will be compiled at the Run time .

like image 78
Srinivas M.V. Avatar answered Oct 14 '22 21:10

Srinivas M.V.


Java is cross platform. Ruby is not. It very much feels like an afterthought of, "oh we have windows users, let's try and get it working".

In Java I have experienced less than 10 cross platform issues in years of heavy use. The areas that this was in, were obviously areas that would be tricky. System/File system specifics.

In ruby, I've experienced problems even when doing the first rails tutorial as have others (https://github.com/twbs/bootstrap-sass/issues/696) . I wouldn't consider ruby cross platform. The platform relies on a whole host of dependencies, which anytime one of them uses anything platform specific the whole thing breaks. i.e. see this error: ExecJS::RuntimeError on Windows trying to follow rubytutorial

I also inherited a largish ruby project and it relied on capistrano, webkit, bcrypt and these needed a dev build kit and native builds. It did not just work. See the people having trouble here: https://github.com/codahale/bcrypt-ruby/issues/116 It's funny, at one point they suggest someone follows a japanese post :)

like image 30
Ryan Hamilton Avatar answered Oct 14 '22 20:10

Ryan Hamilton