How can I make JDK 7 the default JDK in NetBeans?

I uninstalled JDK 1.6.26, then installed JDK 7 and changed my PATH to point to the new version.

However when I now open NetBeans it shows me this error:

enter image description here

Cannot locate java installation in specified jdkhome:
C:\Program Files\Java\jdk1.6.0_25
Do you want to try to use default version?

How can I make JDK 7 the default JDK that NetBeans uses?


Solution 1:

Locate netbeans.conf and change the following according to your JDK location:

"netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_01""

It will solve your problem.

The file may not have writing permission for a regular user so make sure to give yourself permission to write the file if you are unable to save the changes.

Solution 2:

First, try checking your other environment variables for references to the old path. Specifically, check JAVA_HOME and JRE_HOME.

I don't know about NetBeans, but Eclipse tends to remember the JDK location in an internal setting. You may need to reset the path in the NetBeans preferences.

Finally, try searching your registry for references to the old JDK path.