Changing the JDK Version Used by NetBeans

When you install a new JDK on your PC, NetBeans doesn’t automatically use the new JDK, rather it will continue to use the JDK that was defined when NetBeans was installed. This isn’t generally a problem unless you’ve uninstalled the original JDK when installing a new version.

If the JDK that you specified does not exist when NetBeans starts up, is will display an error dialog saying that the original JDK cannot be found and asking if you want to use the default version.

To overccome this problem, we can tell NetBeans which JDK to use. This is done by editing the file NetBeans\etc\netbeans.conf. Within this file, the default JDK to use for NetBeans is defined by the netbeans_jdkhome attribute.

netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_13"

Change this attribute to the path of the JDK that you wish to start NetBeans with, restart the IDE and the appropriate JDK will be used.