JDK 8, OSX, and Netbeans
Have you installed an Early Access Release of JDK 8? You may want to still use JDK 7 for some projects. I have a JavaFX 2 project that needs JDK 7 since there will be API changes in JDK8.
I’ve previously covered using non Apple JDKs on Mountain Lion. Unfortunately, that doesn’t affect NetBeans default JDK.
When you look at the JDKs in NetBeans, you will see one is the “default”. There is no setting to change it to another JDK. So, if you just installed JDK 8, then that is your default now. You can go to individual project and set which JDK you need for that project. But if you want to set the default JDK, you have to change a NetBeans config file.
Edit this file:
1 |
/Applications/NetBeans/NetBeans 7.3.app/Contents/Resources/NetBeans/etc/netbeans.conf |
You want to change the key netbeans_jdkhome like this:
1 |
netbeans_jdkhome=(/usr/libexec/java_home -v 1.7) |
Nope, doesn’t work. That’s a shell command and we’re in just a properties file. So, this doesn’t work either:
1 |
netbeans_jdkhome=$JAVA_HOME |
You need to be explicit.
1 |
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home" |
You can still get the fully qualified path to a particular version of a JDK by typing this in a shell:
1 |
/usr/libexec/java_home -v 1.7 |
Gene,
Thanks a lot. Your explanation and solution worked just fine.
Regards!