The JavaFX SDK is out, but on 32-bit Macs, the SDK installer can't find a JDK 6 and just quits. So no JavaFX on my Intel Core iMac, ever? :-o Not so fast!
Over the weekend I wanted to try out the new JavaFX SDK on my iMac at home. Unfortunately, my Mac was one of the last ones shipped with an "Intel Core" (32 bit) processor. The JavaFX JDK however requires JDK 6, and Apple's JDK 6 not only requires Mac OS X 10.5, but also an "Intel Core 2" processor (64 bit)...
But there is hope. A nice guy named Landon Fuller hosts a free JDK 6 port for 32-bit Macs. I used the NetBeans wiki to keep notes on how I set up JDK 6, the JavaFX SDK and also configure NetBeans IDE as a tool to compile and run JavaFX apps. Here's the short version:
Installing and Testing the SoyLatte JDK 6
Install the JDK 6 from http://landonf.bikemonkey.org/static/soylatte/ and get Java 6 Documentation from http://java.sun.com/javase/downloads/index.jsp. Set up the JAVA_HOME and also add the JDK 6 directory to the PATH. You should now be able to compile JDK 6 code in the terminal.
Installing and Testing the Java FX SDK
Get the JavaFX SDK from http://java.sun.com/javafx/downloads/. If it refuses to install because it doesn't see the JDK, start the installer with the
open command from the Terminal (X11.app). You should now be able to compile JavaFX code in the terminal using the javafxc and javafx commands.
Setting up the NetBeans IDE for JDK 6 and JavaFX
The SoyLatte JDK does not (yet) support the Apple-like Aqua look&feel, so you'll have to work from the terminal (X11.app). To make the NetBeans IDE work with the new JDK 6, you have to start with the following two command line arguments (assuming the SoyLatte install path is /sw/):
/Applications/NetBeans/NetBeans\ 6.1.app/Contents/MacOS/netbeans --jdkhome /sw/soylatte16-i386-1.0.2/ --laf javax.swing.plaf.metal.MetalLookAndFeel
Mac OS expects the Quit, About and Options menu items to be in the Application menu - but in our set-up, the Application menu is owned by X11, which renders those three important menu items inaccessible for NetBeans. To fix the menu bar, follow this great hack posted by Wangwj.
Next, install the JavaFX plugins from http://javafx.netbeans.org/download-compiler-JFXplugin.html. Use the Java Platform manager to show NetBeans where to find the JavaFX platform.
Using an IDE for JavaFX developmentNow you can create and run JavaFX applications in the IDE. For example there's a Component Palette and a GUI preview in the Editor. Also have a look at all the JavaFX samples in the New Project dialog. Check whether your project's properties are set right:
- In the Libraries panel, make certain the project uses the JavaFX Platform.
- In the Sources panel, make certain the source level is set to JavaFX on JDK 6.
Using the SoyLatte JDK allows you to use the JDK 6 and JavaFX together with NetBeans, but it also has some downsides: First there is no Java Web Start (javaws) in SoyLatte.
Second, you will have to work in X11 which has completely different shortcuts than Mac OS – the most important one being left-select & middle-click to do copy & paste. Working in X11 also implies that you won't see individual icons for your Java applications (including NetBeans!) in the dock. If you quit X11.app (white box with black X in the dock), all Java apps will quit too.
PS: Here's the link to the long version if you are not certain about one of the set-up steps: