R. has posted 11 posts at DZone. View Full User Profile

JDK 6 and JavaFX (and NetBeans) on 32-bit Macs

08.21.2008
| 14904 views |
  • submit to reddit

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 development

Now 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:
  1. In the Libraries panel, make certain the project uses the JavaFX Platform.
  2. In the Sources panel, make certain the source level is set to JavaFX on JDK 6.

Notes

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.

Thanks to Landon Fuller for SoyLatte, and Wangwj for his fix to restore the default NetBeans menubar in X11.

PS: Here's the link to the long version if you are not certain about one of the set-up steps:

How to Set Up JDK 6 and JavaFX on 32-bit Intel Macs

 

5
Your rating: None Average: 5 (2 votes)
Published at DZone with permission of its author, R. Kusterer.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Jose Jeria replied on Thu, 2008/08/21 - 2:21pm

JavaFX is supposed to compete with Flash and HTML/JavaScript/Ajax, right?

Above solution is supposed to work for developers, but how about end users that use 32 bit Macs? Why would anybody choose JavaFX to create something that Flash can already do? Flash runs fins on most platforms.

Pete Cox replied on Thu, 2008/08/21 - 7:56pm in response to: Jose Jeria

Pepejeria, you'll have to ask Apple about that one. Good luck with getting a reply.

Java 5 is now a legacy platform and Apple have had several years to produce version 6. You can hardly blame Sun for pushing forward with new technologies to cater for the other 95% of the market.

 

There have been numerous heated discussions on this site about whose responsibility it is to port and maintain Java 6 for PPC and x86(not x86_64) Macs. Landon Fuller has at least made a start, even if it just gives the original poster the chance to developer Java 6 solutions for other platforms.

 

R. Kusterer replied on Thu, 2009/09/24 - 4:17am

News from August 2009: Snow Leopard (Mac OS X 10.6) contains an Apple-provided Java SE 6 version of 1.6.0_15 for both 32 and 64-bit Intel architectures.

Matt Coleman replied on Fri, 2013/01/18 - 1:45am

does this have an updated version?

buffalo freelance website designer 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.