Question

Has anyone tried mixing JavaFX and JRuby? I've built a JRuby desktop application with a Swing GUI (100% JRuby) and I'm toying with the idea of replacing the GUI with JavaFX for a more slick feel.

To fit with my current application, I want to implement an MVC pattern with the View being JavaFX and the Controller and Model being Ruby.

Was it helpful?

Solution

As far as conceptual differences between JavaFX Script,and J Ruby, there are quite a few. I'll start with JRuby. JRuby is not actually a language, per se. It is instead an implementation in Java of the Ruby programming language. The original runtime interpreter for Ruby was written in C (and perhaps some in C++, I'm not sure). The JRuby project was started by some guys who wanted a runtime implementation of Ruby that was written in Java instead.

Why? Well, there are some interesting advantages. First of all, they were able to make it very easy to invoke Java code from a Ruby application. Secondly, it means that Ruby programs end up being run by the Java Virtual Machine (JVM) and therefore can benefit from all the optimization work that has been done on JVMs over the last ten years. Today JRuby functions as an interpreter only, but from what I heard from one of the project leads earlier this month, they are very close to being able to compile Ruby programs directly into JVM bytecode, which would provide another performance boost.

In the end, JRuby is very interesting for projects that are written in Ruby but that want to leverage either: existing Java libraries or existing Java runtimes (the JVM and even application/web servers like GlassFish and Tomcat) or both.

JavaFX on the other hand is scripting language which is directly injected for creating graphics kind of stuff.Very pragmatic too.So coming to usage when you are following a design pattern in this case MVC if you are following the rules it should be fine.But trust there might be very few cases which may started using FX with JRuby.

OTHER TIPS

There is now a JRubyFX gem from the JRuby project for working with JavaFX 2.0. It supports both JavaFX in code and FXML. Most things should work, but it has a few issues that are documented in the Readme.

It will be much easier when JavaFX 2.0 comes out.

As of java 7u6 javafx is now part of the java language and available by default for Linux, Mac, and Windows. You can program this with any language on the jvm so now you should be able to code your application very easily.

JavaFX script was dropped, but JavaFX the technology is bigger and better than ever. Everything is now included in the API directly, so using Groovy or JRuby provide a great scripting framework for using JavaFX.

Happy Coding!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top