Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He oversees the BuildVu product strategy and roadmap in addition to spending lots of time writing code.

NetBeans “Cannot locate java installation in specified jdkhome”?

47 sec read

[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.



Our software libraries allow you to

Convert PDF to HTML in Java
Convert PDF Forms to HTML5 in Java
Convert PDF Documents to an image in Java
Work with PDF Documents in Java
Read and Write AVIF, HEIC, WEBP and other image formats
Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He oversees the BuildVu product strategy and roadmap in addition to spending lots of time writing code.

33 Replies to “NetBeans “Cannot locate java installation in specified jdkhome”?”

  1. Gracias, asi lo hare – en verdad que es incomodo estar aceptando ese mensaje en cada vez que abres NetBenas- Saludos

  2. I know this is an old post, but it seems this is still present in Netbeans 8, so I’m just going to leave this here: if you comment said line out (put a # at the start) the launcher will automatically detect and use a JDK, thus eliminating any future problems 😉

  3. For those having trouble changing it with Notepad, Wordpad, or any other text editor because it says it’s Read-only or any other reason; here is a possible solution:

    Open the .CONF file using NetBeans, and edit in right there in NetBeans. Then click x to close it, and save it, or save it some other way(it doesn’t matter). Then exit or restart the NetBeans IDE, and it that prompt box should disappear.

    1. Hi I’m sorry I still can’t save when I edit in Netbeans. It says “Cannot get exclusive access to ~direction~ (probably opened for reading).” Please help thank you.

  4. i have got an erroe whilw installing netbeans same as given above but it is not running after clicking yes

  5. NetBeans 8.2 – Cannot locate java installation in specified jdkhome?
    Answer: Edit the netbeans.conf file.
    Close NetBeans, start Notepad or another text editor as Administrator. Right click on the Notepad application and choose “Run as administrator” and then open netbeans.conf with it. Change netbeans_jdkhome=”C:\Program Files\…whatever”.

  6. Thanks a lot for this advice. Everytime I deleted the old jdk’s I got this message and never figured out how I could reconfigure the jdk used by NetBeans. It is quite ridiculous NetBeans offers to use the default version for a session only and has no simple option to use it permanently other than messing around with the configuration files.

  7. Thank you! I tried for hours modifying the environment variables and other setting. You are a live saver! 😀

  8. Thanks Leon,

    What worked for me is editing the conf file as follows:

    netbeans_jdkhome=”C:\Program Files\Java”

    This is in case your Java file structure is different, such as with JDK 8u191

    It contains a jre file then the rest of the Java files are scattered about, not in one nice jdk folder like before, so include the entire folder and NetBeans opens one time.

Comments are closed.