Java – How to set the JDK NetBeans runs on

javanetbeans

I have the older NetBeans 6.7, NetBeans 6.9, and NetBeans 7.0, which used to run on jdk1.6.0_21 and jdk1.6.0_25. Now I've removed those JDKs and only have jdk1.6.0_26 and jdk1.7.0 left, but I still want to keep the older versions of NetBeans, but now when I run them, I get this message:

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

I tried to find where it's looking for the "jdk1.6.0_25", and updated a few configuration files in "C:\Program Files (x86)\NetBeans 6.7" and "C:\Users\USER.nbi\registry.xml", and yet the message keeps coming. Where and what do I need to change to point it to C:\Program Files (x86)\Java\jdk1.6.0_26?

Best Answer

Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):

C:\Program Files\NetBeans 7.x\etc\netbeans.conf

Change the following line to point it where your Java installation is:

netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"

You may need administrator privileges to edit netbeans.conf.