Site iconJava PDF Blog

NetBeans “Cannot locate java installation in specified jdkhome”?

[Article updated in January 2019]
I recently came across this message when opening NetBeans after updating my Java version.

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

There are no ill effects from clicking Yes, and everything works as normal within NetBeans, but it’s certainly annoying having to click Yes every time you open NetBeans.

I tried every menu I could find within NetBeans, but was unable to make the message go away. Thankfully, you can fix this message by editing a config file in the NetBeans installation directory located at /etc/netbeans.conf. You will need to open it as an administator to have permission to modify it. For me it was located at:

C:\Program Files\NetBeans 8.2\etc\netbeans.conf

On MacOS you can find it at:

/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

The line you are looking for is:

netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_191"

Which was on line 57 for me.

Simply change this to your current Java version or comment it out completely, and you should no longer see that annoying message! If you comment the line out (by putting a # at the start), the NetBeans launcher will automatically detect and use a JDK. This works for NetBeans 8 with Java 8 and beyond.