Java 7, NetBeans, Mac OS X, and a Little Bit of JavaFX 2
Monday, April 09, 2012 |In a recent post showing how to use JavaFX 2 and NetBeans on the Mac, I noted that I have been unable to run NetBeans using Java 7 on my Mac for reasons I had not been able to figure out. Now, thanks to a pointer from Scott Kovatch, the technical lead at Oracle for the Mac OS X port of Java, I think I can show you how to do that.
In case you missed it, here is his suggestion:
The problem you’re seeing with Java 7 and text on the Mac is a known problem. If you are on a MacBook Pro a workaround is to turn off ‘Automatic graphics switching’ in the Energy Saver preference pane. We think we have a fix.
It’s a simple enough fix that you probably won’t need screen shots, but I’ll do it anyway. :) First, open up your System Preferences and select "Energy Saver":
Now uncheck "Automatic Grahpics Switching":
In case you haven’t installed Java 7, you can grab it here. Once that’s downloaded, open the image and run the installer. This will install the JVM into /Library/Java/JavaVirtualMachines/1.7.0.jdk
. Once that’s ready, you need to modify NetBeans to use the new JDK. The only way I’ve found to do this is to edit netbeans.conf
:
1
sudo vi /Applications/NetBeans\ 7.1.1.app/Contents/Resources/NetBeans/etc/netbeans.conf
Your path may be slightly different, as I moved NetBeans out of the NetBeans folder the installer created, so you may have something like /Applications/NetBeans/NetBeans\ 7.1.1.app/Contents/Resources/NetBeans/etc/netbeans.conf
. At about line 19 or so, you should something like this:
1
#netbeans_jdkhome="/path/to/jdk"
which I changed to this:
1
netbeans_jdkhome=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
Save that, then (re)start NetBeans. You can verify that you are running the correct JDK by opening the About window:
From here, if you want to set things up for JavaFX work, just follow the steps in my last post, but point the Platform Home as well as the JavaFX SDK folder at your Java 7 installation folder, as the Mac OS X JDK previews now ship with JavaFX bundled.
With that, you should be set. If you have any questions, leave a comment, and I’ll make some more swags to see if I can find you an answer. :)