[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 |
Thanks for the help, this works for me. =)
Great! Thanks for sharing.
Worked! Thanks!
Thanks! Сам бы долго думал)
Thanks man! It works fine!
Thanx!
Gracias, asi lo hare – en verdad que es incomodo estar aceptando ese mensaje en cada vez que abres NetBenas- Saludos
Me ajudou ! Obrigado!
Thanks!! 😀
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!
tks for sharing
Thanks buddy….worked for me!!!
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.
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.
Thanks. It worked… 🙂
i have got an erroe whilw installing netbeans same as given above but it is not running after clicking yes
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”.
Thanks! 😀
Thank you Dirk Steyn
Thanks 🙂 It worked fine for me .
Obrigado! Me salvou! 🙂
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.
Thanks!!
Thank you! I tried for hours modifying the environment variables and other setting. You are a live saver! 😀
It’s right!! Thanks!!
Merci
Thanks for sharing such a nice article. It works 100% right!!! Thumbs up bro!
very good, it was useful and solved my problem! Greetings Brazil
thanks man, you save me
Attention Mac OS users: https://stackoverflow.com/a/52959955/2457251
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.
Thanks, and this works for Apache NetBeans too.