Home > Point2 - Technical > Defaulting To JDK 1.6 In NetBeans 6.5 On OSX

Defaulting To JDK 1.6 In NetBeans 6.5 On OSX

February 17, 2009

We try to stay current with our technologies at Point2. An example of this is using the most recent Java platform, Java 6 (JDK 1.6) and modern IDEs such as NetBeans 6.5. However, staying up to date with technology is not always as simple as it could be. Java 6 was released in December 2006 and NetBeans 6.5 was released almost 2 years later in November 2008 and yet it still wants to use Java 5 (JDK 1.5) as the default Java Platform, regardless of what you have set in the OSX Java preferences. Here is how you can set NetBeans 6.5 to use JDK 1.6 by default.

  • Ensure that JDK 1.6 and NetBeans 6.5 are installed
  • Locate the NetBeans config file, typically located at “/Applications/NetBeans/NetBeans 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf” and open the file in your favourite editor
  • Set the “netbeans_jdkhome” parameter to the JDK 1.6 home directory (ie. netbeans_jdkhome=
  • In NetBeans, right click on the project in the project window and select “Properties”
  • Ensure the “Source/Binary Format” is set to “1.6”
  • Click on “Tools” on the toolbar and select “Java Platforms”
  • Under “J2SE” the default platform should now be “JDK 1.6”

By: Damien Gabrielson

  1. NetbeansUser
    March 7, 2009 at 7:01 AM

    Is there any way to default source/binary format to 6 for all projects?

  2. April 2, 2009 at 10:30 AM

    Thanks, man. Good write up.

  3. jasonsmart
    April 4, 2009 at 2:41 PM

    Thanks for this,
    Being a OS X noob though, it took me a while to find out I needed to CRTL-Click on /Applications/Netbeans/Netbeans 6.5.app and choose “Show Package Contents” in order to get to the rest of the path Contents/Resources/Netbeans/etc/netbeans.conf

    Also searching for netbeans.conf using Spotlight produced no results.

  4. April 15, 2009 at 8:31 AM

    Very helpful, but one additional step was necessary for my needs:

    * Open the “asenv.conf” file. In my case, it can be found at: /Applications/NetBeans/glassfish-v2ur2/config/asenv.conf
    * Set the “AS_JAVA” parameter to the Java 1.6 directory. My entry reads:

  5. dgp2
    April 20, 2009 at 11:46 AM

    Thanks Hugh for the great comment. A co-worker was trying to get glassfish to use 1.6, which also uses 1.5 by default, and what you said is exactly what is needed to get it working! Thanks again.

  6. Bharat Manocha
    May 18, 2009 at 11:50 PM

    thanks for info 😉 i had lost lots of time before visiting this link. it’s really worthful (:-)

  7. David Ferrero
    August 11, 2009 at 8:43 AM

    My main interest was to debug an application running with JDK 1.6 from within NetBeans. But the Project–>Properties–>Java Sources Classpath : Java Platform never displayed JDK 1.6 as a choice even though I have 1.6 installed and even though OS X Java Preferences was set to default to JDK 1.6.

    Obvious now, but I simply clicked Manage Java Platforms –> Add Platform and navigated to JDK 1.6.0/Home then added the src.jar and docs.jar and bingo – I am now able to debug my application spawned with Ant from JDK 1.6 from within NetBeans running with JDK 1.5.

  8. Nathan
    August 20, 2009 at 2:58 PM

    Finally! Thanks god for you buddy.. was a breeze after going through your blog.. good stuff.

  9. Jeff
    November 20, 2009 at 11:22 AM

    thanks! very handy

  10. August 6, 2010 at 7:08 PM

    Thanks for the help! It really works…

  11. Wiili
    January 24, 2011 at 12:34 PM

    Exelente Hermano Buen Tip, Jajaja GReat Help!!!

    • March 23, 2011 at 12:22 PM

      Muchas gracias!

  12. February 7, 2011 at 5:15 AM

    is there any to check which version of JD I am using on mac?

    • March 23, 2011 at 12:26 PM

      In your system preferences there is a java control panel or you can just run “java -version” from the terminal.

  1. April 2, 2009 at 10:35 AM
  2. April 20, 2009 at 1:47 PM
  3. May 18, 2009 at 7:30 PM
  4. June 4, 2009 at 1:50 PM
  5. August 7, 2010 at 1:34 PM
Comments are closed.
%d bloggers like this: