Wednesday 26 September 2012

JavaFX 2.1 examples on Linux x64

JavaFX 2.1 Developer Preview for Linux has been released recently, unfortunately only for 32bit architecture. But what about x64? Well, I have Ubuntu x64 10.04 LTS and it also works :D! Here are the tips to run BrickBreaker example, which comes with JavaFX SDK examples.

To download SDK preview we should look at proper download section here. Also we need to download latest JavaSE JDK 7 but for Linux x86 (despite the fact we are using 64-bit Linux). After downloading all necessary packages, just unpack them wherever you want.

Right now JavaFX SDK examples are distributed in separate package. It is available at the bottom of this page (notice that we need examples for Linux!). Inside package we may find src directory with BrickBreaker sources, a simple game which we will compile and run.

The easiest choice of IDE for latest JavaFX release is Netbeans 7. To be able to run and compile FX projects we need to setup Java platforms. Just select "Tools->Java Platforms" from the menu. Click "Add platform..." and select directory when we have extracted JavaSE JDK 7, then select "Finish". We have added new JVM, but we need to enable FX. Select new added Java platform in "Java Platform Manager" window and navigate to "JavaFX" tab. Enable JavaFX and point to JavaFX SDK directory by clicking "Browse..." next to "JavaFX SDK:" input.

Now we can open BrickBreaker project in NetBeans and open its properties window. Navigating to "Libraries" section in "Project Properties" window we should select Java platform with enabled JavaFX libraries. Then we can compile and run project right from IDE.

0 comments:

Post a Comment