How to specify Java Home on Mac OS X

After applying Software Update Java for OS X 2012-006 1.0 - http://support.apple.com/kb/HT5493 - Mac OS X users are no longer able to use the Java Preferences application to specify the version of Java that is used by applications. After applying the update, NetBeans IDE runs on the most recent version of Java that is installed, with Java SE 6 as the minimum required version.

To change the Java Home that is used by the IDE to a version of Java that is not the most recent version you should specify the version in the netbeans.conf configuration file.

Step by step:

  1. Open any editor
  2. Press CMD+O (to open the "Open Dialog Windows")
  3. In the opened window press CMD+SHIFT+G (to enter the path manually)
  4. Type "/Applications/NetBeans/NetBeans 7.3 Beta 2.app/Contents/Resources/NetBeans/etc/netbeans.conf" or "/Applications/NetBeans/NetBeans 7.3 Beta 1.app/Contents/Resources/NetBeans/etc/netbeans.conf" or "/Applications/NetBeans/NetBeans 7.2.1.app/Contents/Resources/NetBeans/etc/netbeans.conf" or "/Applications/NetBeans/NetBeans 7.2.app/Contents/Resources/NetBeans/etc/netbeans.conf" or whatever version of NetBeans you've got, and press ENTER (or click on "Go" button)
  5. Press ENTER again (or click on "Open" button)
  6. In the netbeans.conf file, search the line that looks like this #netbeans_jdkhome="/path/to/jdk"
  7. Under this line add netbeans_jdkhome="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
  8. Press CMD+S to save the document.

Applies to: NetBeans IDE 7.2 or later

Platforms: Mac OS X 10.7 or later

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo