Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

NetBeans “Cannot locate java installation in specified jdkhome”?

49 sec read

I recently came across this message when opening NetBeans after updating my Java version from 1.7.0_05 to 1.7.0_07.

Cannot locate Java installation in specified jdkhome:
C:\Program Files\Java\jdk1.7.0_05
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 annoying having to click Yes each time you open NetBeans right?

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. For me this was:

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

The line you are looking for is:

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

Which was on line 57 for me.

Simply change this to your current Java version and you should no longer see that annoying message!

Update August 2015:
In the comments, Andrew has recommended that it’s possible to comment the above line out (put a # at the start) and the launcher will automatically detect and use a JDK, which will work for NetBeans 8 with Java 8 and beyond.

This post is part of our “NetBeans article Index” series. In these articles, we aim to explore NetBeans in different ways, from useful hint and tips, to our how-to’s, experiences and usage of the NetBeans IDE.

Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

Hacking the NetBeans IDE – 4. Changing the way…

To help us prepare for our talks for our talks at Oracle CodeOne – “Writing Better Code (Faster) in the Apache NetBeans IDE ” and “Hacking...
Mark Stephens
1 min read

30 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! 😀

Leave a Reply

Your email address will not be published. Required fields are marked *