How do I make NetBeans recognize my JDK 6 installation on Mac OS X?

If you have JDK 6 installed on your machine and NetBeans is not locating the installation, you may need to set the default Java version in the Java Preferences. To set the default Java version for applications and applets, open Applications > Utilities > Java > Java Preferences and move Java SE 6 to the top of the list of preferred JVMs.

For more about checking the default Java version, see JavaAndMacOS

NetBeans IDE 6.7 users
\ NetBeans IDE 6.7 should automatically use the default JVM specified in the Java Preferences.

NetBeans IDE 6.5 and earlier
\ In earlier versions of the IDE you may need to explicitly specify the JVM used by the IDE by starting the IDE with a command line switch or modifying the NetBeans configuration file.

You can explicitly specify the JDK that the IDE uses in the following ways:

Use a command line switch
\ Start NetBeans from the command line and use the following command line switch to point to the JDK location
\ netbeans --jdkhome /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

Modify the NetBeans configuration file
\ The configuration file netbeans.conf is located in NetBeans.app/Contents/Resources/NetBeans/etc/.
\ Edit the file to modify the default location for the JDK.
\ # Default location of JDK, can be overridden by using --jdkhome <dir>: netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

The configuration file is a hidden file. You can edit the file in the Terminal or use a text editor that can locate hidden files.

There is a good thread with some additional information on setting up Java on Mac OS X at http://lists.apple.com/archives/java-dev/2008/Aug/msg00176.html

For more information about Java on Mac OS X, see http://developer.apple.com/java/

\ For more documentation about using NetBeans on Mac OS X, see NetBeansMacOSX

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