Monday, March 12, 2012

Running JavaFX Apps on Slackware

JavaFX is a software platform for creating and delivering rich Internet applications that can run across a wide variety of connected devices. JavaFX is still an old plain Java code that gets compiled into bytecode, so that it can run on many platforms, including desktops, mobile, browsers, gaming console, and many others.

Unfortunately, when we install JDK on Linux, JavaFX SDK is not included and in fact, Oracle hasn't fully supported JavaFX on Linux and Macintosh. The only platform provided on the Download page is for Windows only. So how do we run JavaFX on Linux?

The answer is by using the Developer Preview of JavaFX 2.1. It seems that Oracle is planning to roll out support for Linux and OSX on the next release of JavaFX. You need to download 2 files, JavaFX SDK and JavaFX Samples (the sample is required to test that our installation is working well).

Once you download the SDK, unpack it and go to the directory created
cd javafx-sdk2.1.0-beta

Next, extract the JavaFX samples inside the JavaFX SDK directory
unzip so the structure of the directory is like this:
Once it's done, you can try running the examples provided by executing the .jar files under javafx-samples-2.1.0-beta/ directory. For example, to run the SwingInterop example, run this command:
java -jar SwingInterop.jar
and voila...........

I will write another post shortly after this to add integration to NetBeans so that you can start developing JavaFX-based applications using NetBeans