NetBeans “Cannot locate java installation in specified jdkhome”?

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.

Related Posts:

The following two tabs change content below.
Leon is a developer at IDRsolutions and product manager for JPDF2HTML5. He is responsible for managing the JPDF2HTML5 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 JPDF2HTML5.
Leon Atherton

About Leon Atherton

Leon is a developer at IDRsolutions and product manager for JPDF2HTML5. He is responsible for managing the JPDF2HTML5 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 JPDF2HTML5.

24 thoughts on “NetBeans “Cannot locate java installation in specified jdkhome”?

  1. Mario

    Thanks for the help, this works for me. =)

  2. Fernando Zamora

    Great! Thanks for sharing.

  3. Michaela Bačíková

    Worked! Thanks!

  4. Дмитрий

    Thanks! Сам бы долго думал)

  5. Claudio

    Thanks man! It works fine!

  6. Thanx!

  7. Abel

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

  8. Alef

    Me ajudou ! Obrigado!

  9. Thanks!! 😀

  10. Andrew

    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 😉

    • Thanks for the suggestion Andrew, I have added an update to the article with that information!

  11. Craig

    tks for sharing

  12. Ram

    Thanks buddy….worked for me!!!

  13. NEUR0S!S

    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.

    • Diana

      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.

  14. Sourav Chakraborty

    Thanks. It worked… 🙂

  15. Mustafa

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

  16. 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”.

    • Dinan

      Thanks! 😀

    • subhani

      Thank you Dirk Steyn

  17. Soniya Vijay

    Thanks 🙂 It worked fine for me .

  18. José Neto

    Obrigado! Me salvou! 🙂

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

  20. Brian

    Thanks!!

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>